Patch
A patch object that describes a mutation on an object.
{type: "add", key, value}
add
patches signal that a key was added to an object.
{ type: "add", key: "b", value: 1 }
Parameters
- key
{String}
:The name of the key that was added to the object.
- value
{Any}
:The value of the key after it was added.
{type: "delete", key}
delete
patches signal that a key was deleted from an object.
{ type: "delete", key: "a" }
Parameters
- key
{String}
:The name of the key that was deleted from the object.
{type: "set", key, value}
set
patches signal that an existing key's value was set to another value.
{ type: "set", key: "c", value: 2 }
Parameters
- key
{String}
:The name of the key that was update on the object.
- value
{Any}
:The value of the key after it was set.
{type: "splice", index, deleteCount, insert}
splice
patches signal a list-like object had enumerable values added, removed
or both at a specific index.
{ type: "splice", index: 0, deleteCount: 10, insert: [ item1, item2 ] }
Parameters
- index
{Number}
:The index where values were added, removed, or both.
- deleteCount
{Number}
:The number of items removed at the index.
- insert
{Array<Any>}
:An array of items inserted.
{type: "move", fromIndex, toIndex}
move
patches signal a list-like object had an enumerable value move from one
position to another.
{ type: "move", fromIndex: 1, toIndex: 2 }
Parameters
- fromIndex
{Number}
:The starting index of the value.
- toIndex
{Number}
:The index the value was moved to.
{type: "values", delete, insert}
values
patches signal a container-like object (like Set
) has
had items added or removed.
{ type: "values", delete: [ item0 ], insert: [ item1, item2 ] }
Parameters
- delete
{Array<Any>}
:The items added to the object.
- insert
{Array<Any>}
:The items removed from the object.