ability to only load ressources with specified tags #21

Open
wants to merge 1 commit into
from

Conversation

Projects
None yet
1 participant

Hey.
I added the following functionality:

It is now possible to load ressources in groups, defined by tags. Each group can have an own completionListener.
An example: you want to load a group of ressources on document ready. Later, when the user performs a specific action, you want to preload other ressources and treat them differently when loading is complete.

All you have to do is pass true as a second argument to the start-function (specifiedTagsOnly).

A quick demo: http://jsbin.com/ugojeb/2/

loader.addImage( 'http://placekitten.com/200/300', 'initial' );
loader.addImage( 'http://placekitten.com/200/300', 'content' );

loader.addCompletionListener(function() {
    [...]
}, 'initial');
loader.addCompletionListener(function() {
    [...]
}, 'content');

loader.start('initial', true);
$('button').on('click', function() {
  loader.start('content', true);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment