Skip to content

Instantly share code, notes, and snippets.

@trobrock
Created July 7, 2009 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trobrock/142298 to your computer and use it in GitHub Desktop.
Save trobrock/142298 to your computer and use it in GitHub Desktop.
Trouble getting the MooTools periodical function working, now working
// I am getting the error:
// 'this.clock = this.iterateClock(current, future).periodical(1000, this); is undefined'
// After it display the days left once, it throws the error
//
// This is now the working version
var Main = new Class({
Implements : [Options],
options : {
release_date : '1 January, 2010',
},
initialize : function(options) {
this.setOptions(options);
this.startClock();
},
startClock : function(){
this.clock = this.iterateClock.periodical(1000, this);
},
iterateClock : function(current, future){
var current = $time();
var future = new Date(this.options.release_date);
future = future.getTime();
var difference = future - current;
var days = Math.floor((difference / (60 * 60 * 24)) / 1000);
console.log(days);
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment