evt.detach(ctx?)
Similar to EventEmitter.prototype.removeListener()
Detach all handlers from the Evt or all Evt's handler that are bound to a given context.
The prefered way of detaching handler in TS-EVT is via Ctx<T>
.
Calling this method without passing a context argument is almost never a good idea. An Evt instance should be sharable by modules that are isolated one another. If a module take the liberty to call evt.detach() it can brek the code elswhere.
To chery pick the handlers to detach use evt.getHandlers()
or ctx.getHandlers()
``
Returns
Handler<T,any>[]
array of Handler that have been detached.
Parameters
ctx?: Ctx
If Ctx
is provided only Handler bound to the given context will be removed.
Examples
To detach all handlers at once:
Using a context argument
Last updated