Skip to content

Instantly share code, notes, and snippets.

@varundevpro
Created January 8, 2018 05:12
Show Gist options
  • Save varundevpro/11b3388ee8ac298258b6ad7f3bb0b302 to your computer and use it in GitHub Desktop.
Save varundevpro/11b3388ee8ac298258b6ad7f3bb0b302 to your computer and use it in GitHub Desktop.
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
NodeList.prototype.on = NodeList.prototype.addEventListener = function (name, fn) {
this.forEach(function (elem, i) {
elem.on(name, fn);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment