SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    removeEventListener with function literal

    Question: does anyone know how to use DOM removeEventListener() with a lambda expression? Apparently, the Function (object) passed in that method needs to be the same as the one bound with addEventListener(), and simply reproducing the argument creates a new object, naturally. I've got this inside a constructor and the method doesn't work. TIA

    adios
    ::: certified wild guess :::

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can't you just store a reference to the one you attach? (like when doing a setTimeout/clearTimeout)
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks beetle - pretty much what I ended up doing. I was registering these handlers from within a constructor, using a closure to keep the instance properties in scope, and couldn't seem to 'capture' the function literal - so I just made it a data member (d'oh), and all was well.

    cheers, adios
    ::: certified wild guess :::


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •