mcollina / bloomrun

A js pattern matcher
MIT License
120 stars 10 forks source link

Remove all handlers for a pattern regardless of payload #10

Closed mcdonnelldean closed 9 years ago

mcdonnelldean commented 9 years ago

@mcollina I would like to have the ability to kill all patterns regardless of their payload, I'm not sure how the interface for this should look though. The two options I can think of are:

The use case is when anonymous functions are used but the consumer needs to ensure no handlers of a specific pattern exists. In my case I need to kill certain handlers based on a render cycle.

mcdonnelldean commented 9 years ago

@mcollina I've been thinking about his more and I wonder should the default api be:

The current implementation doesn't really allow annon functions at all, or at least doesn't allow the ability to remove them.

mcollina commented 9 years ago

I'm +1 on this semantic. Il giorno lun 14 set 2015 alle 21:37 Dean McDonnell < notifications@github.com> ha scritto:

@mcollina https://github.com/mcollina I've been thinking about his more and I wonder should the default api be:

  • remove(pattern) - removes all patterns regardless of payload
  • remove(pattern, null) - removes patterns with no payload
  • remove(pattern, payload) - removes pattern with matching payload

The current implementation doesn't really allow annon functions at all, or at least doesn't allow the ability to remove them.

— Reply to this email directly or view it on GitHub https://github.com/mcollina/bloomrun/issues/10#issuecomment-140185327.

mcdonnelldean commented 9 years ago

Awesome, I'll get to it.

mcdonnelldean commented 9 years ago

Completed as of #11