[ReactNative] Register assets with AssetRegistry

This commit is contained in:
Alex Kotliarskyi
2015-05-07 17:30:41 -07:00
parent 736d860571
commit c76fb40ec4
5 changed files with 66 additions and 53 deletions

View File

@@ -0,0 +1,20 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @providesModule AssetRegistry
*/
'use strict';
var assets = [];
function registerAsset(asset) {
// `push` returns new array length, so the first asset will
// get id 1 (not 0) to make the value truthy
return assets.push(asset);
}
function getAssetByID(assetId) {
return assets[assetId - 1];
}
module.exports = { registerAsset, getAssetByID };