onKeysRemoved
Register an event handler on a MapLike object, triggered on keys being deleted.
onKeysRemoved(obj, handler)
Register an event handler on the Map-like object obj
to trigger when a key or keys are removed from
obj
's keyset. obj
must implement @@can.onKeysRemoved to be
compatible with can-reflect.onKeysAdded. The function passed as handler
will receive an Array of
Strings as its one argument.
var obj = new CanMap({ foo: "bar" });
canReflect.onKeys(obj, function(diffs) {
console.log(JSON.stringify(diffs));
});
foo.removeAttr("foo"); // -> logs '["foo"]'
Parameters
- obj
{Object}
:an observable MapLike that can listen to changes in named properties.
- handler
{function(Array)}
:the callback function to receive the array of removed keys