Skip to content

Instantly share code, notes, and snippets.

@made-by-chris
Created December 7, 2016 20:06
Show Gist options
  • Select an option

  • Save made-by-chris/c73edf3ff650de0e7d5d1bec1ca8b520 to your computer and use it in GitHub Desktop.

Select an option

Save made-by-chris/c73edf3ff650de0e7d5d1bec1ca8b520 to your computer and use it in GitHub Desktop.
$ = function(parameters) {
this.state = {};
this.state.nodeList = document.querySelectorAll(parameters)
this.state.dom = [].slice.call(state.nodeList)
return this instanceof $ ? this : new $(parameters)
}
$.prototype = {
left: function(){
console.log(this.state.dom.length, "turning left")
return this
},
right: function(){
console.log(this.state.dom.length, "turning right")
return this
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment