Interface: LoaderParserAdvanced

LoaderParserAdvanced

A more verbose version of the LoaderParser, allowing you to set the loaded, parsed, and unloaded asset separately

Properties:
Name Type Description
config CONFIG

A config to adjust the parser

extension ExtensionMetadata

Should be ExtensionType.LoaderParser

load (url: string, resolvedAsset: ResolvedAsset<META_DATA>, loader: Loader) => Promise<ASSET | T>

This is the promise that loads the URL provided resolves with a loaded asset if returned by the parser.

name string

The name of the parser (this can be used when specifying loadParser in a ResolvedAsset)

parse (asset: ASSET, resolvedAsset: META_DATA<ResolvedAsset>, loader: Loader) => Promise<PARSED_ASSET | T>

Gets called on the asset it testParse passes. Useful to convert a raw asset into something more useful

test (url: string, resolvedAsset: ResolvedAsset<META_DATA>, loader: Loader) => boolean

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!

testParse (asset: ASSET, resolvedAsset: META_DATA<ResolvedAsset>, loader: Loader) => Promise<boolean>

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

unload (asset: UNLOAD_ASSET, resolvedAsset: META_DATA<ResolvedAsset>, loader: Loader) => Promise<void> | void

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

Members

config CONFIG

A config to adjust the parser

extension ExtensionMetadata

Should be ExtensionType.LoaderParser

load (url: string, resolvedAsset: ResolvedAsset<META_DATA>, loader: Loader) => Promise<ASSET | T>

This is the promise that loads the URL provided resolves with a loaded asset if returned by the parser.

name string

The name of the parser (this can be used when specifying loadParser in a ResolvedAsset)

parse (asset: ASSET, resolvedAsset: META_DATA<ResolvedAsset>, loader: Loader) => Promise<PARSED_ASSET | T>

Gets called on the asset it testParse passes. Useful to convert a raw asset into something more useful

test (url: string, resolvedAsset: ResolvedAsset<META_DATA>, loader: Loader) => boolean

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!

testParse (asset: ASSET, resolvedAsset: META_DATA<ResolvedAsset>, loader: Loader) => Promise<boolean>

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

unload (asset: UNLOAD_ASSET, resolvedAsset: META_DATA<ResolvedAsset>, loader: Loader) => Promise<void> | void

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