Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return child loaders when adding one or multiple items. #221

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

endel
Copy link

@endel endel commented Jan 3, 2017

Not a breaking change. It's helpful to add listeners only on some child loaders created inside a LoadQueue.

Example:

var child1 = queue.loadFile(file1);
var child2 = queue.loadFile(file2);

// child item is complete
child1.on("complete", function() { ... });

// all items are complete
queue.on("complete", function() { ... })

@lannymcnie
Copy link
Member

Thanks! Will do some testing before accepting. Cheers.

@endel
Copy link
Author

endel commented Jan 29, 2017

One downside I've seen recently by using this approach is that when adding "complete" listener on the child loader, that item won't be present in the LoadQueue instance yet, due to EventListener dispatching events in FILO order.

The last "complete" listener registered will be the first one to be dispatched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants