UNPKG

@ablestack/rdo

Version:

A library to facilitate building and running graphs of Reactive Domain Objects - connecting JSON data sources to reactive client applications

47 lines 2.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RdoSyncableCollectionNW = void 0; const logger_1 = require("../../infrastructure/logger"); const rdo_key_based_collection_nw_base_1 = require("../base/rdo-key-based-collection-nw-base"); const logger = logger_1.Logger.make('RdoSyncableCollectionNW'); class RdoSyncableCollectionNW extends rdo_key_based_collection_nw_base_1.RdoKeyCollectionNWBase { constructor({ value, typeInfo, key, mutableNodeCache, wrappedParentRdoNode, wrappedSourceNode, syncChildNode, defaultEqualityComparer, matchingNodeOptions, globalNodeOptions, targetedOptionMatchersArray, eventEmitter, }) { super({ typeInfo, key, mutableNodeCache, wrappedParentRdoNode, wrappedSourceNode, defaultEqualityComparer, syncChildNode, matchingNodeOptions, globalNodeOptions, targetedOptionMatchersArray, eventEmitter }); //------------------------------ // RdoIndexCollectionNWBase //------------------------------ this.onAdd = ({ key, newItem }) => { this.value.add({ key, newItem }); return true; }; this.onReplace = ({ key, origItem, newItem }) => { this.value.replace({ key, origItem, newItem }); return true; }; this.onDelete = ({ key, origItem }) => { this.value.delete({ key, origItem }); return true; }; this._value = value; } //------------------------------ // IRdoNodeWrapper //------------------------------ get isLeafNode() { return false; } get value() { return this._value; } //------------------------------ // IRdoCollectionNodeWrapper //------------------------------ elements() { return this._value.elements(); } childElementCount() { return this._value.size; } } exports.RdoSyncableCollectionNW = RdoSyncableCollectionNW; //# sourceMappingURL=rdo-synchable-collection-nw.js.map