Class cc.loader

Class Summary
Constructor Attributes Constructor Name and Description
 
Loader for resource loading process.

Method Summary

Class Detail

cc.loader()
Loader for resource loading process. It's a singleton object.

Method Detail

  • {*} getRes(url)
    Get resource data by url.
    Parameters:
    url
    Returns:
    {*}
  • {*} getUrl(basePath, url)
    Get url with basePath.
    Parameters:
    {string} basePath
    {string} url Optional
    Returns:
    {*}
  • {XMLHttpRequest} getXMLHttpRequest()
    Get XMLHttpRequest.
    Returns:
    {XMLHttpRequest}
  • {cc.AsyncPool} load(resources, option, loadCallback)
    Load resources then call the callback.
    Parameters:
    {string} resources
    {function} option Optional
    callback or trigger
    {function|Object} loadCallback Optional
    Returns:
    {cc.AsyncPool}
  • loadAliases(url, callback)

    Loads alias map from the contents of a filename.

    Parameters:
    {String} url
    The plist file name.
    {Function} callback Optional
  • {Image} loadImg(url, option, callback)
    Load a single image.
    Parameters:
    {!string} url
    {object} option Optional
    {function} callback
    Returns:
    {Image}
  • {*} loadJs(baseDir, jsList, cb)
    Load js files. If the third parameter doesn't exist, then the baseDir turns to be "".
    Parameters:
    {string} baseDir Optional
    The pre path for jsList or the list of js path.
    {array} jsList
    List of js path.
    {function} cb Optional
    Callback function
    Returns:
    {*}
  • loadJson(url, cb)
    Load a single resource as json.
    Parameters:
    {string} url
    {function} cb Optional
    arguments are : err, json
  • loadJsWithImg(baseDir, jsList, cb)
    Load js width loading image.
    Parameters:
    {string} baseDir Optional
    {array} jsList
    {function} cb Optional
  • loadTxt(url, cb)
    Load a single resource as txt.
    Parameters:
    {string} url
    {function} cb Optional
    arguments are : err, txt
  • register(extNames, loader)
    Register a resource loader into loader.
    Parameters:
    {string} extNames
    {function} loader
  • release(url)
    Release the cache of resource by url.
    Parameters:
    url
  • releaseAll()
    Resource cache of all resources.