off
Remove an event listener.
compute.off(eventType, handler)
const age = compute( 33 );
const handler = function( ev, newVal, oldVal ) {
ev; //-> {type: "change", batchNum: 5}
newVal; //-> 34
oldVal; //-> 33
};
age.on( "change", handler );
age( 34 );
age.off( "change", handler );
Parameters
- eventType
{String}
:The name of the event to bind on, usually
change
. - handler
{function(event, args...)}
:The handler to be removed. This has to be the same function that was passed to on.