Last active
August 29, 2015 14:06
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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