Skip to content

Instantly share code, notes, and snippets.

@plcstevens
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plcstevens/977fa03cf0e8acb521fb to your computer and use it in GitHub Desktop.
Save plcstevens/977fa03cf0e8acb521fb to your computer and use it in GitHub Desktop.
Possible implementation technique for future JavaScipt library. This would avoid issues with asynchronous vs synchronous method calls and also allow for a very verbose API that would be easily extendable.
(function(url, name){
(window.ReevooMarkObjects = window.ReevooMarkObjects || []).concat([name]);
window[name] = window[name] || function(){
(window[name].queue = window[name].queue || []).push([arguments]);
};
var script = document.createElement("script");
script.async = true;
script.src = url;
var parent = document.getElementsByTagName("script")[0];
parent.parentNode.insertBefore(script,parent);
})("http://cdn.mark.reevoo.com/assets/reevoo_mark.js", "reevoo");
reevoo('load', 'CYS');
reevoo('init_badges', 'CYS', ['product', 'reputation']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment