two things:
1) whenever you chain methods, they must return something:
var foo = function(){ return "foo"; };
foo().indexOf('f'); //0
Note we're calling foo(), which returns "foo", and then .indexOf is a method
of String, which foo returns.
your method, iterateClock, does not return anything, so your example:
this.iterateClock(current, future).periodical(1000, this);
you call this.iterateClock() which doesn't return anything and then attempt
to call .periodical (a method of functions) on the undefined non-value.
If you want to call periodical on iterateClock, you should call it directly
on the method:
this.iterateClock.periodical(1000, this, [current, future]);
And if you wanted to chain something off of that method, you'd need to
return something, for example, if you added "return this;" to iterateClock,
you could do this:
this.iterateClock(current, future).foo()
if your class had a "foo" method.
2) just a side note, you have a syntax error in your example. your last
method in the example has a comma after it; this will break in IE.
On Tue, Jul 7, 2009 at 1:50 PM, trobrock (via Nabble) <
[email protected]<ml-user%[email protected]>
> wrote:
>
> I am having trouble getting a class function to run periodically. It
> runs once fine, but then I get a function is undefined error. The
> related code can be seen here: http://gist.github.com/142298
>
>
> ------------------------------
> View message @
> http://n2.nabble.com/-Moo--Periodical-Problems-tp3221873p3221873.html
> To start a new topic under MooTools Users, email
> [email protected]<ml-node%[email protected]>
> To unsubscribe from MooTools Users, click here< (link removed) >.
>
>
>
-----
The MooTools Tutorial: http://www.mootorial.com www.mootorial.com
Clientcide: http://www.clientcide.com www.clientcide.com
--
View this message in context:
http://n2.nabble.com/-Moo--Periodical-Problems-tp3221873p3222140.html
Sent from the MooTools Users mailing list archive at Nabble.com.