WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 setInterval in an object, chris, July 10, 2003
     Re:setInterval in an object, k, July 11, 2003
         Re:setInterval in an object, Erik Arvidsson, July 11, 2003
             Re:setInterval in an object, Chris, July 13, 2003
             Re:setInterval in an object , tim scarfe, July 12, 2003
                 Re:setInterval in an object , Erik Arvidsson, July 13, 2003
             Re:setInterval in an object, k, July 11, 2003
                 Re:setInterval in an object, Erik Arvidsson, July 11, 2003

Subject: Re:setInterval in an object From: Erik Arvidsson Date: July 11, 2003
Why not use higher order functions. Much cleaner in my opinion.

function Chris() {
this.method1 = someFunction;
var oThis = this;
window.setInterval(function () { oThis.method1(); }, 1000);
}
var dummy = new Chris();

Or if you forget about IE:

function Chris() {
this.method1 = someFunction;
window.setInterval(function (o) { o.method1(); }, 1000, this);
}
var dummy = new Chris();

erik



Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX