Skip to content

Allow EventListener to be removed within its own handler #23

Description

@mikesol

I'm wondering if it'd be possible to have some sort of Lazy instantiation of EventListener? It's often the case that I call removeEventListener in the body of an event listener, which requires having a handle to the event listener.

Conceptually laziness seems to be safe, as I don't think an EventListener can be called during the same tick as its creation without some unsafeCoerce-ery. At the same time, I'm not quite sure how to implement that API wise. I'm pretty sure there's a language extension that accomplishes this in Haskell (when you have a left-binded expression that refers to its own variable name) but I forget the name.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions