Interface: LoaderParser

LoaderParser

The interface to define a loader parser (all functions are optional).

When you create a parser object, the flow for every asset loaded is:

  1. 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!
  2. parser.load() - This is the promise that loads the URL provided resolves with a loaded asset if returned by the parser.
  3. 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 asset
  4. parse.parse() - Gets called on the asset it testParse passes. Useful to convert a raw asset into something more useful

Some loaders may only be used for parsing, some only for loading, and some for both!