AdvancedOptionalconfigA config to adjust the parser
OptionalextensionShould be ExtensionType.LoaderParser
The name of the parser (this can be used when specifying parser in a ResolvedAsset)
OptionalloadThis is the promise that loads the URL provided resolves with a loaded asset if returned by the parser.
The URL to load
OptionalresolvedAsset: ResolvedAsset<META_DATA>Any custom additional information relevant to the asset being loaded
Optionalloader: LoaderThe loader instance
OptionalnameOptionalparseGets called on the asset it testParse passes. Useful to convert a raw asset into something more useful
The loaded asset data
OptionalresolvedAsset: ResolvedAsset<META_DATA>Any custom additional information relevant to the asset being loaded
Optionalloader: LoaderThe loader instance
OptionaltestEach 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!
The URL to test
OptionalresolvedAsset: ResolvedAsset<META_DATA>Any custom additional information relevant to the asset being loaded
Optionalloader: LoaderThe loader instance
OptionaltestThis 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
The loaded asset data
OptionalresolvedAsset: ResolvedAsset<META_DATA>Any custom additional information relevant to the asset being loaded
Optionalloader: LoaderThe loader instance
OptionalunloadIf 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
The asset to unload/destroy
OptionalresolvedAsset: ResolvedAsset<META_DATA>Any custom additional information relevant to the asset being loaded
Optionalloader: LoaderThe loader instance
The interface to define a loader parser (all functions are optional).
When you create a
parserobject, 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 usefulSome loaders may only be used for parsing, some only for loading, and some for both!