Events
The returned proxied object supports .on(event, callback) using an internal EventEmitter.
Supported Events
| Event | When It Fires | Arguments |
|---|---|---|
add |
A new property, array element, Map key, or Set value is added | (path, oldValue, newValue) |
update |
An existing property, array element, or Map key is updated | (path, oldValue, newValue) |
delete |
A property, array element, Map key, or Set value is removed | (path, oldValue) |
clear |
Map.clear() or Set.clear() is called |
(path, oldSnapshot) |
Notes:
- For nested objects,
pathautomatically represents the full path (e.g.,user.address.city). - Arrays emit
updateevents for structural methods (push,pop,shift,unshift,splice,sort,reverse) with the updated array state. - Maps emit events for
set,delete, andclear. - Sets emit events for
add,delete, andclear.