DataChangeCallback: ((data, ptr, removed?, op?) => void)

A callback function that is triggered when data changes.

This callback supports both the legacy removed boolean parameter and the new op parameter to avoid breaking existing clients while allowing for more descriptive operations.

  • When removed is provided, it indicates whether the data was removed (true for delete, false for set).
  • When op is provided, it specifies the operation performed on the data:
    • "set": The data was set or updated.
    • "delete": The data was deleted.
    • "forceSetInternal": A forced internal set operation was performed.

Both removed and op are optional. If both are provided, op takes precedence in interpreting the operation.

Type declaration

    • (data, ptr, removed?, op?): void
    • Parameters

      • data: any

        The data that was changed and is pointed to by ptr

      • ptr: JsonPointerString | JsonPointerString[]

        The JSON pointer string indicating where in the root object the change occurred. In the case of callbacks registered on "/", ptr will be an array of JSON pointers into the data field represents the root object.

      • Optional removed: boolean

        (optional) A boolean indicating whether the data was removed. true for delete, false for set.

      • Optional op: Op

        (optional) A string describing the operation. Can be "set", "delete", or "forceSetInternal".

      Returns void

Generated using TypeDoc