feat(lib/assets): export getAllAssets

This commit is contained in:
PalmDevs 2025-05-10 02:06:55 +07:00
parent f6c7ddb908
commit 456829e92a
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA

View file

@ -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.**
*