onInstancePatches
Registers a handler that listens to patch events on any instance
onInstancePatches(Type, handler(instance, patches))
Listens to patch changes on any instance of Type
. This is used by can-connect
to know when a potentially unbound
instance's id
changes. If the id
changes,
the instance can be moved into the store while it is being saved. E.g:
canReflect.onInstancePatches(Map, function onInstancePatches(instance, patches) {
patches.forEach(function(patch){
if(
(patch.type=== "add" || patch.type === "set") &&
patch.key=== connection.idProp &&
canReflect.isBound(instance)
){
connection.addInstanceReference(instance);
}
});
});
Parameters
- Type
{*}
: - handler
{function(*)}
: