Comparing version
@@ -56,26 +56,26 @@ "use strict"; | ||
create: function (db, obj) { | ||
var objects = {}; | ||
// const objects = {} as { [key in string]: AgTmObject<any> } | ||
var tm = {}; | ||
var _loop_1 = function (key, value) { | ||
var map = AgReactiveMap_1.AgReactiveMap.create(); | ||
(0, AgVueWrap_1.watch)(function () { return Object.keys(value); }, function (v) { | ||
var _loop_2 = function (nid) { | ||
if (!map.get(nid)) { | ||
var tmobj = objects[nid] || (objects[nid] = new AgTmObject_1.AgTmObject(db, nid)); | ||
tmobj.bind(function () { return value[nid]; }); | ||
map.set(nid, tmobj); | ||
var map = AgReactiveMap_1.AgReactiveMap.create(function (id) { | ||
var obj = new AgTmObject_1.AgTmObject(db, id); | ||
obj.bind(function () { return value[id]; }); | ||
return { | ||
value: obj, | ||
stop: function () { | ||
obj.unbind(); | ||
} | ||
}; | ||
}); | ||
(0, AgVueWrap_1.watch)(function () { return Object.keys(value); }, function (v) { | ||
for (var _i = 0, v_1 = v; _i < v_1.length; _i++) { | ||
var nid = v_1[_i]; | ||
_loop_2(nid); | ||
if (!map[nid]) | ||
map.push(nid); | ||
} | ||
var newIds = new Set(v); | ||
for (var _a = 0, _b = map.keys; _a < _b.length; _a++) { | ||
for (var _a = 0, _b = Object.keys(map); _a < _b.length; _a++) { | ||
var old = _b[_a]; | ||
if (!newIds.has(old)) { | ||
var tmobj = map.get(old); | ||
tmobj.unbind(); | ||
map.del(old); | ||
} | ||
if (!newIds.has(old)) | ||
map.remove(old); | ||
} | ||
@@ -85,3 +85,3 @@ }, { immediate: true, deep: true }); | ||
get: function (target, p) { | ||
return map.get(p); | ||
return map[p]; | ||
} | ||
@@ -88,0 +88,0 @@ }); |
{ | ||
"name": "ag-repo", | ||
"version": "1.0.182", | ||
"version": "1.0.183", | ||
"description": "", | ||
@@ -9,7 +9,7 @@ "author": "", | ||
"@types/node": "^20.1.0", | ||
"ag-bundle": "^2.0.106", | ||
"ag-bundle": "^2.0.161", | ||
"ag-remote": "^1.0.40" | ||
}, | ||
"dependencies": { | ||
"ag-utilities": "^1.1.199", | ||
"ag-utilities": "^1.1.206", | ||
"mongodb": "^5.4.0" | ||
@@ -16,0 +16,0 @@ }, |
163624
-0.03%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated