Skip to content

Commit

Permalink
added bling
Browse files Browse the repository at this point in the history
  • Loading branch information
jswiss committed Dec 22, 2017
1 parent b7efac0 commit 0406d8e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions public/javascripts/modules/bling.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// based on https://gist.github.com/paulirish/12fb951a8b893a454b32

const $ = document.querySelector.bind(document);
const $$ = document.querySelectorAll.bind(document);

Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
};

NodeList.prototype.__proto__ = Array.prototype; // eslint-disable-line

NodeList.prototype.on = NodeList.prototype.addEventListener = function (name, fn) {
this.forEach((elem) => {
elem.on(name, fn);
});
};

export { $, $$ };
Empty file.

0 comments on commit 0406d8e

Please sign in to comment.