[x] #new adds support for first argument that answers to .match. If present, it is stored as endpoint.
[x] #add adds support for first argument that answers to .match when second argument is a Function.
[x] #remove adds support for first argument that answers to match and searches for an endpoint that is === to this argument, and removes the subscriber with that endpoint. (note: the second argument is ignored)
[x] #link same extension as #add
[x] #unlink same extension as #remove
[x] #send if there is an endpoint, only run the callback if the endpoint returns true when matching!
[x] still nameless a method that takes the argument and removes all subscribers that return true when matching.
Open question: should pure Function endpoint types be supported? The idea is to use the Function as the match method.
Changes:
#new
adds support for first argument that answers to.match
. If present, it is stored asendpoint
.#add
adds support for first argument that answers to.match
when second argument is aFunction
.#remove
adds support for first argument that answers tomatch
and searches for anendpoint
that is===
to this argument, and removes the subscriber with that endpoint. (note: the second argument is ignored)#link
same extension as#add
#unlink
same extension as#remove
#send
if there is anendpoint
, only run the callback if the endpoint returnstrue
when matching!true
when matching.Open question: should pure
Function
endpoint types be supported? The idea is to use theFunction
as thematch
method.