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: k Date: July 11, 2003
function Chris() {
this.method1 = someFunction;
var oThis = this;
window.setInterval(function () { oThis.method1(); }, 1000);
}
var dummy = new Chris();

_Maybe_ I'm wrong (it's been a long time since I used javascript), but I think that 'oThis' is shared between all 'Chris' instances (i.e. private static variable)

maybe if the lambda function is only evaluated once by setInterval ??

that context-evaluation-thingie will always puzzle me :/



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