offKeyValue
Unregister an event handler on a MapLike object, based on a key change
offKeyValue(obj, key, handler, [queueName])
Unregister a handler from the Map-like object obj
that had previously been registered with
onKeyValue. The function passed as handler
will no longer be called
when the value of key
on obj
changes.
var obj = new DefineMap({ foo: "bar" });
var handler = function(newVal, oldVal) {
console.log("foo is now", newVal, ", was", oldVal);
};
canReflect.onKeyValue(obj, "foo", handler);
canReflect.offKeyValue(obj, "foo", handler);
obj.foo = "baz"; // -> nothing is logged
Parameters
- obj
{Object}
:an observable MapLike that can listen to changes in named properties.
- key
{String}
:the key to stop listening to
- handler
{function(*)}
:the callback function that should be removed from the event handlers for
key
- queueName
{String}
:the queue that the handler was set to receive events from