I'm trying to have a cursor blink every 2.5 seconds but I'm not sure how to 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 don't know how to pass in the parameters in action; it won't work.开发者_运维知识库
Any insight to this would be greatly appreciated.
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
});
精彩评论