PreloadJS makes preloading assets & getting aggregate progress events easier in JavaScript. It uses XHR2 when available, and falls back to tag-based loading when not.
JavaScript CSS HTML
Clone or download
Pull request Compare This branch is 27 commits ahead, 101 commits behind CreateJS:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
_assets
build
docs
examples
extras
lib
src
tests
.gitignore
LICENSE.txt
README.md
README_CREATEJS_NAMESPACE.txt
VERSIONS.txt
bower.json
icon.png

README.md

PreloadJS

PreloadJS is a library to make working with asset preloading easier. It provides a consistent API for loading different file types, automatic detection of XHR (XMLHttpRequest) availability with a fallback to tag-base loading, composite progress events, and a plugin model to assist with preloading in other libraries such as SoundJS.

Example

var preload = new createjs.LoadQueue(false);
preload.addEventListener("fileload", handleFileComplete);
preload.loadFile('http://createjs.com/assets/images/png/createjs-badge-dark.png');
function handleFileComplete(event) {
	document.body.appendChild(event.result);
}

Support and Resources

Built by gskinner.com, and is released for free under the MIT license, which means you can use it for almost any purpose (including commercial projects). We appreciate credit where possible, but it is not a requirement.

Classes

LoadQueue The main class that manages all preloading. Instantiate a LoadQueue instance, load a file or manifest, and track progress and complete events. Check out the docs for more information.

SpringRoll changes

  • Changed re-initialization in LoadQueue.remove(), so that cross origin settings are retained.
  • Added a checks for url parsing errors, so that you can see what url is missing a file extension and is breaking LoadQueue.
  • Made a small change to XHRRequest's _checkError() to be more Cordova friendly.
  • Removed version number from built files, versioning is handled by the Git tags & Bower.
  • Added a fallback in ImageLoader._formatResult() to handle iOS6 and other browsers that don't do URL.createObjectURL() properly.