Interface for record patch handlers objects that can be invoked when patch
operations are applied to a record. Each method is optional and even if
present is called only if the patch detects that the operation changes the
current record (except the "test" operation).
Methods
-
onInsert(op, ptr, newValue, oldValue)
-
Called when a value is added to an array or map property as a result of an "add", "move" or "copy" patch operation.
Parameters:
Name Type Description opstring The operation, which can be "add", "move" or "copy". ptrmodule:x2node-pointers~RecordElementPointer Path pointer. newValue* The value inserted (may be nullfor a simple value array or map element, but neverundefined).oldValue* Previous value at the location. -
onRemove(op, ptr, oldValue)
-
Called when a value is removed from an array or map property as a result of a "remove" or "move" patch operation.
Parameters:
Name Type Description opstring The operation, which can be "remove" or "move". ptrmodule:x2node-pointers~RecordElementPointer Path pointer. oldValue* Previous value at the location. -
onSet(op, ptr, newValue, oldValue)
-
Called when a value is set to a property as a result of an "add", "remove", "replace", "move" or "copy" patch operation.
Parameters:
Name Type Description opstring The operation, which can be "add", "remove", "replace", "move" or "copy". ptrmodule:x2node-pointers~RecordElementPointer Path pointer. newValue* The new value (may be nullbut neverundefined).oldValue* Previous value at the location. -
onTest(ptr, value, passed)
-
Called when a property value is tested as a result of a "test" patch operation.
Parameters:
Name Type Description ptrmodule:x2node-pointers~RecordElementPointer Path pointer. value* The value tested (may be nullbut neverundefined).passedboolean trueif the test operation passed.