feat(lib/assets): export getAllAssets
This commit is contained in:
parent
f6c7ddb908
commit
456829e92a
1 changed files with 7 additions and 0 deletions
|
|
@ -10,6 +10,13 @@ export { AssetRegistry, AssetRegistryModuleId } from './preinit'
|
|||
// iOS cannot display SVGs
|
||||
let _preferredType: Asset['type'] = ReactNative.Platform.OS === 'ios' ? 'png' : 'svg'
|
||||
|
||||
/**
|
||||
* Yields all registered assets, including ones with same name but different types, custom assets, and overriden assets.
|
||||
*/
|
||||
export function* getAllAssets() {
|
||||
for (const name of _assets.keys()) for (const asset of Object.values(_assets.get(name)![1])) yield asset
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an asset by its ID. **This may throw an error if the asset-registry has not been initialized.**
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue