offEvent
Unregister an event handler on a MapLike object, based on a key change
offEvent(obj, eventName, callback)
Unregister an event handler from the object obj
that had previously been registered with
onEvent. The function passed as callback
will no longer be called
when the event named eventName
is dispatched on obj
.
var obj = new DefineMap({ foo: "bar" });
var handler = function(ev, newVal, oldVal) {
console.log("foo is now", newVal, ", was", oldVal);
};
canReflect.onEvent(obj, "foo", handler);
canReflect.offEvent(obj, "foo", handler);
canEvent.dispatch.call(obj, "foo", ["baz", "quux"]); // -> nothing is logged
Parameters
- obj
{Object}
:the object to unbind an event handler from
- eventName
{String}
:the name of the event to unbind the handler from
- callback
{function(*)}
:the handler function to unbind from the event