LogoPixi’VN
pixi-jsInterfaces

Interface: CacheParser<T>

Defined in: node_modules/pixi.js/lib/assets/cache/CacheParser.d.ts:14

For every asset that is cached, it will call the parsers test function the flow is as follows:

  1. cacheParser.test(): Test the asset.
  2. 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)

Advanced

Type Parameters

T

T = any

Properties

config?

> optional config?: Record<string, any>

Defined in: node_modules/pixi.js/lib/assets/cache/CacheParser.d.ts:18

A config to adjust the parser


extension?

> optional extension?: ExtensionMetadata

Defined in: node_modules/pixi.js/lib/assets/cache/CacheParser.d.ts:16

The extension type of this cache parser


getCacheableAssets

> getCacheableAssets: (keys, asset) => Record<string, any>

Defined in: node_modules/pixi.js/lib/assets/cache/CacheParser.d.ts:32

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.

Parameters

keys

string[]

The keys to cache the assets under

asset

T

The asset to get the cacheable assets from

Returns

Record<string, any>

A key-value pair of cacheable assets


test

> test: (asset) => boolean

Defined in: node_modules/pixi.js/lib/assets/cache/CacheParser.d.ts:23

Gets called by the cache when a dev caches an asset

Parameters

asset

T

the asset to test

Returns

boolean