|
Re: [jQuery] Is there a way to "endAll()"?: msg#01219lang.javascript.jquery
Hi, > I like the idea of endAll(), but it won't help plugin developers: > > To savely restore the state, you could do something like this (untested): > jQuery.fn.plugin = function() { > var oldStack = $.merge( [], this.stack ); > // do other stuff > this.stack = oldStack; > return this; > }; I just had the idea of savepoints: jQuery.fn.savepoint = function() { if( ! this.savePoints ) this.savePoints = []; this.savepoints.push(this.stack.length); return this; } jQuery.fn.savepointReturn = function() { if( ! this.savepoints || this.savepoints.length == 0 ) return this; return this.get(this.stack[this.savepoints.pop()]); } then you can do: jQuery.fn.plugin = function() { this.savepoint(); // do other stuff return this.savepointReturn(); }; Christof
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: [jQuery] Beginner questions, Erin Doak |
|---|---|
| Next by Date: | Re: [jQuery] Possible changes to hide/show, Klaus Hartl |
| Previous by Thread: | Re: [jQuery] Is there a way to "endAll()"?, "Jörn Zaefferer" |
| Next by Thread: | [jQuery] Stopping animate() on command, Paul Bakaus |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |