From: Hans-Georg Michna on 13 Jan 2010 17:25 On Wed, 13 Jan 2010 07:31:44 -0800 (PST), Scott Sauyet wrote: >On Jan 13, 5:06�am, Hans-Georg Michna <hans- >georgNoEmailPle...(a)michna.com> wrote: >> I did have to do something to prevent multiple activations >> though, and I had already done it, but with that stupid mistake. >> Now it works just fine. >> >> I set a variable or property instead, because it feels more >> atomic. >Why not set that as a property of the function itself? > > function myOneAtATimeFunc() { > if (arguments.callee.running) { > return; > } > arguments.callee.running = true; > > // your processing here > > // At end of function or in AJAX callback: > arguments.callee.running = false; > } > >This keeps it out of larger scopes, but does what you need, I believe. Thanks! That's just what I'm doing, except that I don't have to use arguments.callee, because my function is named. Hans-Georg
First
|
Prev
|
Pages: 1 2 Prev: string with apostrophes Next: FAQ Topic - How do I protect my javascript code? (2010-01-13) |