Skip to content

Instantly share code, notes, and snippets.

@velyo
Created July 17, 2014 07:18
Show Gist options
  • Save velyo/ab26bf42536a3faedae8 to your computer and use it in GitHub Desktop.
Save velyo/ab26bf42536a3faedae8 to your computer and use it in GitHub Desktop.
function ShopAsyncQueue() {
this.push = function () {
for (var i = 0; i < arguments.length; i++) {
try {
if (typeof arguments[i] === "function") arguments[i]();
else {
// TODO
}
}
catch (e) {
if (console) console.warn(e.message);
}
}
};
};
window.onload = function () {
// execute async queue on load finished
var _q = q;
window._saq = new ShopAsyncQueue();
window._saq.push.apply(window._saq, _q);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment