CacheParser
interface CacheParser
For every asset that is cached, it will call the parsers test function the flow is as follows:
cacheParser.test()
: Test the asset.cacheParser.getCacheableAssets()
: If the test passes call the getCacheableAssets function with the asset
Useful if you want to add more than just a raw asset to the cache (for example a spritesheet will want to make all its sub textures easily accessible in the cache)
Summary
Properties from CacheParser
Record<string, any> |
A config to adjust the parser |
(keys: string[], asset: T) => Record<string, any> |
|
(asset: T) => boolean |
|
Public Properties
getCacheableAssets: (keys: string[], asset: T) => Record<string, any>
If the test passes, this function is called to get the cacheable assets an example may be that a spritesheet object will return all the sub textures it has so they can be cached.
Name | Type | Description |
---|---|---|
keys |
The keys to cache the assets under |
|
asset |
The asset to get the cacheable assets from |
Type | Description |
---|---|
A key-value pair of cacheable assets |
test: (asset: T) => boolean
Gets called by the cache when a dev caches an asset
Name | Type | Description |
---|---|---|
asset |
the asset to test |