mol_data_all 1.1.1401 → 1.1.1403
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node.test.js +26 -2
- package/node.test.js.map +1 -1
- package/package.json +1 -1
package/node.test.js
CHANGED
|
@@ -2152,18 +2152,42 @@ var $;
|
|
|
2152
2152
|
factories.set(val, make);
|
|
2153
2153
|
return make;
|
|
2154
2154
|
}
|
|
2155
|
+
const getters = new WeakMap();
|
|
2156
|
+
function get_prop(host, field) {
|
|
2157
|
+
let props = getters.get(host);
|
|
2158
|
+
let get_val = props?.[field];
|
|
2159
|
+
if (get_val)
|
|
2160
|
+
return get_val;
|
|
2161
|
+
get_val = (next) => {
|
|
2162
|
+
if (next !== undefined)
|
|
2163
|
+
host[field] = next;
|
|
2164
|
+
return host[field];
|
|
2165
|
+
};
|
|
2166
|
+
Object.defineProperty(get_val, 'name', { value: field });
|
|
2167
|
+
if (!props) {
|
|
2168
|
+
props = {};
|
|
2169
|
+
getters.set(host, props);
|
|
2170
|
+
}
|
|
2171
|
+
props[field] = get_val;
|
|
2172
|
+
return get_val;
|
|
2173
|
+
}
|
|
2155
2174
|
function $mol_wire_sync(obj) {
|
|
2156
2175
|
return new Proxy(obj, {
|
|
2157
2176
|
get(obj, field) {
|
|
2158
2177
|
let val = obj[field];
|
|
2178
|
+
const temp = $mol_wire_task.getter(typeof val === 'function' ? val : get_prop(obj, field));
|
|
2159
2179
|
if (typeof val !== 'function')
|
|
2160
|
-
return
|
|
2161
|
-
const temp = $mol_wire_task.getter(val);
|
|
2180
|
+
return temp(obj, []).sync();
|
|
2162
2181
|
return function $mol_wire_sync(...args) {
|
|
2163
2182
|
const fiber = temp(obj, args);
|
|
2164
2183
|
return fiber.sync();
|
|
2165
2184
|
};
|
|
2166
2185
|
},
|
|
2186
|
+
set(obj, field, next) {
|
|
2187
|
+
const temp = $mol_wire_task.getter(get_prop(obj, field));
|
|
2188
|
+
temp(obj, [next]).sync();
|
|
2189
|
+
return true;
|
|
2190
|
+
},
|
|
2167
2191
|
construct(obj, args) {
|
|
2168
2192
|
const temp = $mol_wire_task.getter(factory(obj));
|
|
2169
2193
|
return temp(obj, args).sync();
|