Skip to content

Instantly share code, notes, and snippets.

@mars13code
Created February 3, 2018 22:25
Show Gist options
  • Save mars13code/b32c5b89e9c161524002953fb5d3f965 to your computer and use it in GitHub Desktop.
Save mars13code/b32c5b89e9c161524002953fb5d3f965 to your computer and use it in GitHub Desktop.
var go = function (...tabParam) {
if (tabParam.length == 1) {
var $d = document;
var selector = tabParam[0];
console.log(selector)
go.tabSelect = $d.querySelectorAll(selector);
return go;
}
};
go.on = function (eventType, action) {
for(e of this.tabSelect) {
e.addEventListener(eventType, action);
}
return this;
};
go.scroll = function (event)
{
console.log('scroll ' + performance.now());
};
go.mousemove = function (event)
{
console.log('mousemove ' + performance.now());
};
go("html,body").on("mousemove", go.mousemove);
window.addEventListener("scroll", go.scroll);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment