Options
All
  • Public
  • Public/Protected
  • All
Menu

Extended parameters of a mutation event

Hierarchy

Index

Properties

fromProto: boolean

True if the mutation has occurred on a prototype of the watched object

obj: object

Link to the object that is watched

originalPath: unknown[]

The original path to a property that was changed.

example
function pathModifier(path) {
return path.map((chunk) => chunk.replace(/^_/, ''));
}

const {proxy} = watch(a: 1, b: 2, _a: 1}, 'a', {pathModifier}, (mutations) => {
mutations.forEach(([value, oldValue, info]) => {
console.log(value, oldValue, info.path, info.originalPath);
});
});

// 2 1 ['a'], ['_a']
proxy._a = 2;

Information about the parent mutation event

path: unknown[]

Path to a property that was changed

root: object

Link to the root object of watching

top?: object

Link to the top property of watching (the first level property of the root)