Function setParser

  • setParser(type, parserFn): void
  • specify a parser/preload function for the given asset type

    Parameters

    • type: string

      asset type

    • parserFn: Function

      parser function

    Returns void

    Memberof

    loader

    See

    Asset.type

    Example

    // specify a custom function for "abc" format
    functioncustomAbcParser(data, onload, onerror) {
    // preload and do something with the data
    letparsedData = doSomething(data);
    // when done, call the onload callback with the parsed data
    onload(parsedData);
    // in case of error, call the onerror callback
    onerror();
    // return the amount of asset parsed
    return1
    }
    // set the parser for the custom format
    loader.setParser("abc", customAbcParser);

Settings

Member Visibility

AltStyle によって変換されたページ (->オリジナル) /