Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Preload all your images for canvas. Works in either browser or in node.
JavaScript
Branch: master
Failed to load latest commit information.
dist reflects the merge change in dist
example fixed example
README.md update readme
index.js fix typo
package.json 0.0.3

README.md

imagepreloader

The same file works in both places.

In Node

You can either

var Preload = require('imagepreloader');
var Image = require('canvas').Image;
var preload = new Preload({Image:Image});

Or,

In your browser

Just copy the index.js file so that you can load it from HTML. Feel free to rename it.

<script src='index.js'></script>
<script>
    var preload = new Preloader;
</script>

Then

var preload = new Preloader;
preload
    .add('Lenna.png')
    .add('teapot-phong-illuminated.png') 
    .success(drawIt)
    .error(myerror)
    .done();

How To Use

Just open your browser to

example/browser/index.html

Or cd /example/node and run

node test.js
Something went wrong with that request. Please try again.