Skip to content

Instantly share code, notes, and snippets.

@leekiernan
Last active December 21, 2015 04:19
Show Gist options
  • Save leekiernan/6248266 to your computer and use it in GitHub Desktop.
Save leekiernan/6248266 to your computer and use it in GitHub Desktop.
Quick mock
function Counter(length) {
this.length = (typeof length == 'undefined') ? 5 : length;
this.iterator = (typeof this.iterator == 'undefined') ? 0 : this.iterator;
this.next = function() {
return ( this.iterator > this.length) ? this.iterator = 0 : this.iterator++;
}
this.slide = function() {
console.log("IT: "+ this.iterator );
_next = this.next( this.iterator );
console.log("count2: "+ this.iterator );
return this.iterator;
}
this.count = function() {
};
}
var a = new Counter(5);
setInterval( function() { return a.slide() }, 1000 );
var b = new Counter(5);
setInterval( function() { return b.slide() }, 1000 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment