Interface: LoaderParser<ASSET, META_DATA, CONFIG>
Defined in: node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.d.ts:95
The interface to define a loader parser (all functions are optional).
When you create a parser object, the flow for every asset loaded is:
parser.test()- Each URL to load will be tested here, if the test is passed the assets are loaded using the load function below. Good place to test for things like file extensions!parser.load()- This is the promise that loads the URL provided resolves with a loaded asset if returned by the parser.parser.testParse()- This function is used to test if the parse function should be run on the asset If this returns true then parse is called with the assetparse.parse()- Gets called on the asset it testParse passes. Useful to convert a raw asset into something more useful
Advanced
Extends
LoaderParserAdvanced<ASSET,ASSET,ASSET,META_DATA,CONFIG>
Type Parameters
ASSET
ASSET = any
META_DATA
META_DATA = any
CONFIG
CONFIG = Record<string, any>
Properties
config?
> optional config?: CONFIG
Defined in: node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.d.ts:28
A config to adjust the parser
Inherited from
extension?
> optional extension?: ExtensionMetadata
Defined in: node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.d.ts:26
Should be ExtensionType.LoaderParser
Inherited from
LoaderParserAdvanced.extension
id
> id: string
Defined in: node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.d.ts:34
The name of the parser (this can be used when specifying parser in a ResolvedAsset)
Inherited from
load?
> optional load?: <T>(url, resolvedAsset?, loader?) => Promise<ASSET | T>
Defined in: node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.d.ts:51
This is the promise that loads the URL provided resolves with a loaded asset if returned by the parser.
Type Parameters
T
T
Parameters
url
string
The URL to load
resolvedAsset?
ResolvedAsset<META_DATA>
Any custom additional information relevant to the asset being loaded
loader?
The loader instance
Returns
Promise<ASSET | T>
Inherited from
~~name?~~
> optional name?: string
Defined in: node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.d.ts:32
Deprecated
Use id instead.
Inherited from
parse?
> optional parse?: <T>(asset, resolvedAsset?, loader?) => Promise<ASSET | T>
Defined in: node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.d.ts:66
Gets called on the asset it testParse passes. Useful to convert a raw asset into something more useful
Type Parameters
T
T
Parameters
asset
ASSET
The loaded asset data
resolvedAsset?
ResolvedAsset<META_DATA>
Any custom additional information relevant to the asset being loaded
loader?
The loader instance
Returns
Promise<ASSET | T>
Inherited from
test?
> optional test?: (url, resolvedAsset?, loader?) => boolean
Defined in: node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.d.ts:43
Each URL to load will be tested here, if the test is passed the assets are loaded using the load function below. Good place to test for things like file extensions!
Parameters
url
string
The URL to test
resolvedAsset?
ResolvedAsset<META_DATA>
Any custom additional information relevant to the asset being loaded
loader?
The loader instance
Returns
boolean
Inherited from
testParse?
> optional testParse?: (asset, resolvedAsset?, loader?) => Promise<boolean>
Defined in: node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.d.ts:59
This function is used to test if the parse function should be run on the asset If this returns true then parse is called with the asset
Parameters
asset
ASSET
The loaded asset data
resolvedAsset?
ResolvedAsset<META_DATA>
Any custom additional information relevant to the asset being loaded
loader?
The loader instance
Returns
Promise<boolean>
Inherited from
LoaderParserAdvanced.testParse
unload?
> optional unload?: (asset, resolvedAsset?, loader?) => void | Promise<void>
Defined in: node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.d.ts:74
If an asset is parsed using this parser, the unload function will be called when the user requests an asset to be unloaded. This is useful for things like sounds or textures that can be unloaded from memory
Parameters
asset
ASSET
The asset to unload/destroy
resolvedAsset?
ResolvedAsset<META_DATA>
Any custom additional information relevant to the asset being loaded
loader?
The loader instance
Returns
void | Promise<void>