UNPKG

fluidstate

Version:

Library for fine-grained reactivity state management

55 lines (53 loc) 2.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getObjectSetChanges = exports.getObjectDeleteChanges = void 0; var _reactivePlugin = require("./reactive-plugin"); /** * Generates a list of change descriptions for an object set operation. * This function is intended to be called when a property is set on an object. * * @param object The reactive object proxy. * @param property The property key (string or symbol) being set. * @param previousValue The value of the property *before* the set operation. * @param nextValue The new value being set for the property. * @returns An array of ReactiveChange objects, or null if no reportable changes occurred (though current implementation always returns a change). */ const getObjectSetChanges = (object, property, previousValue, nextValue) => { const objectChange = { type: _reactivePlugin.ObjectChangeType.SetProperty, property, previousValue, nextValue }; return [{ type: _reactivePlugin.ReactiveChangeType.Object, object, objectChange }]; }; /** * Generates a list of change descriptions for an object delete operation. * This function is intended to be called when a property is deleted from an object. * * @param object The reactive object proxy. * @param property The property key (string or symbol) being deleted. * @param previousValue The value of the property *before* the delete operation. * @returns An array of ReactiveChange objects, or null if no reportable changes occurred (though current implementation always returns a change). */ exports.getObjectSetChanges = getObjectSetChanges; const getObjectDeleteChanges = (object, property, previousValue) => { const objectChange = { type: _reactivePlugin.ObjectChangeType.DeleteProperty, property, previousValue }; return [{ type: _reactivePlugin.ReactiveChangeType.Object, object, objectChange }]; }; exports.getObjectDeleteChanges = getObjectDeleteChanges; //# sourceMappingURL=reactive-plugin-object.js.map