views:

31

answers:

1

Hi I'm trying to have a cursor blink every 2.5 seconds but I'm not sure how tot use the SC.Timer object....The method I should be calling is _drawInsertionPoint(rect,context) every 2.5 seconds....

I found this

var timer = SC.Timer.schedule({
target: this
action: '_drawInsertionPoint(rec,context)',
interval: 100,
repeats: YES,
until: Time.now() + 1000
}) ;

But I dont know how to pass in the parameters in action... it won't work

any insight to this would be greatly appreciated...

Thanks

+1  A: 

You need to pass an anonymous function as the action parameter, like this:

var timer = SC.Timer.schedule({
    target: this
    action: function() { _drawInsertionPoint(rec,context); },
    interval: 100,
    repeats: YES,
    until: Time.now() + 1000
});
SLaks
And how can I call this or does it automatically get called
Rob
It works the same way as your code, but instead of evaluating the string, the timer will call the function.
SLaks