arguments.callee?

Cheers
Ralf.

On Sat, Sep 27, 2008 at 2:12 AM, Matt Bennett <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> In certain javascript libraries I've used previously, there is the
> ability to create a single-fire event listener -- one that
> automatically removes itself as a listener immidiately after it has
> executed.
>
> I'd really like a generic solution that just involved an overridden
> 'addEventListener' function and an optional 'single-fire' argument.
> Hopefully someone out there has solved this problem already.
>
> In the mean time however, I tried a more simplistic approach - calling
> removeEventListener inside my listener function, so it runs once and
> then removes itself. I can't get this approach to work for anonymous
> functions though, because I don't know how the anonymous function can
> refer to itself. There doesn't appear to be anything useful in the
> Event object passed to the listener, the 'this' keyword refers to
> something else, and I don't know how to alter the scope with which the
> listener function is called.
>
> Does anyone have a simple way to acheive this?
>
> Many thanks,
> Matt.
>
> 

Reply via email to