Created
July 7, 2009 19:30
-
-
Save trobrock/142298 to your computer and use it in GitHub Desktop.
Trouble getting the MooTools periodical function working, now working
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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