Skip to content

Instantly share code, notes, and snippets.

Seth Westphal westy92

Block or report user

Report or block westy92

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@westy92
westy92 / QueuedCallback.js
Last active Oct 13, 2017
Queued Callback
View QueuedCallback.js
/*
Sometimes you need to queue things up before a callback is available. This solves that issue.
Push any item(s) to an array.
Once you want to start consuming these items, pass the array and a callback to QueuedCallback().
QueuedCallback will overload array.push as your callback and then cycle through any queued up items.
Continue to push items to that array and they will be forwarded directly to your callback. The array will remain empty.
Compatible with all browsers and IE 5.5+.
*/
You can’t perform that action at this time.