Resource Loader
A generic resource loader, made with web games in mind.
Usage
const loader = new Loader();
loader
.add(name, url, options)
.pre(cachingMiddleware)
.use(parsingMiddleware)
.load((loader, resources) => {
});
loader.onProgress.add(() => {});
loader.onError.add(() => {});
loader.onLoad.add(() => {});
loader.onComplete.add(() => {});
Building
You will need to have node and gulp setup on your machine.
Then you can install dependencies and build:
npm i && npm run build
That will output the built distributables to ./dist
.
Supported Browsers
- IE 9+
- FF 13+
- Chrome 20+
- Safari 6+
- Opera 12.1+
Upgrading to v2
- No more events, all signals now
- No more isJson, isXml, etc. Now use
res.type === Resource.TYPE.JSON
, etc. - Removed
before
(in favor of pre
) and after
(in favor of use
). - If a middleware adds more resources, it must pass in the parent resource in options for
.add()
.