Too much recursion 

Higher Order Javascript


   Subscribe in NewsGator Online    Subscribe in Rojo    Add to Google      Add to My AOL   Subscribe in FeedLounge   Add to netvibes  

Brendan Eich's Roadmap  Standard ECMA-262  Yahoo! UI Library     

Sunday, August 20, 2006


Easy Class setTimeout call keeping 'this'

I'm working on an a.p.i called this.js. Its a jquery clone in its functionality... I needed to call functions within the same class, keeping this all the same. (arguments can be passed using the same technique, but it borks in IE6..its better to have the arguments as class members anyway). Here is some code from this.js showing the technique:
/// fadeIn 
this.fadeIn= function ( speed, delay ){'visible';
this.op(0); this._fadeIn.count = 0;
if (delay) { var _me=this;
setTimeout( function(){_me._argList[1]= speed; _me._fadeIn()}, delay*1000, _me );
} // call the fade function and returns this
else{ this._argList[1]= speed; this._fadeIn() }; return this;

Looking forward to this.js
If you need beta testing you know where to turn ;-)
Thanks for sharing such an interesting post with us. You have made some valuable points which are very useful for all readers
Post a Comment

Links to this post:

Create a Link

<< Home


June 2006   July 2006   August 2006   September 2006  

This page is powered by Blogger. Isn't yours?