mol_plot_all 1.2.1321 → 1.2.1323

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.js CHANGED
@@ -2128,18 +2128,42 @@ var $;
2128
2128
  factories.set(val, make);
2129
2129
  return make;
2130
2130
  }
2131
+ const getters = new WeakMap();
2132
+ function get_prop(host, field) {
2133
+ let props = getters.get(host);
2134
+ let get_val = props?.[field];
2135
+ if (get_val)
2136
+ return get_val;
2137
+ get_val = (next) => {
2138
+ if (next !== undefined)
2139
+ host[field] = next;
2140
+ return host[field];
2141
+ };
2142
+ Object.defineProperty(get_val, 'name', { value: field });
2143
+ if (!props) {
2144
+ props = {};
2145
+ getters.set(host, props);
2146
+ }
2147
+ props[field] = get_val;
2148
+ return get_val;
2149
+ }
2131
2150
  function $mol_wire_sync(obj) {
2132
2151
  return new Proxy(obj, {
2133
2152
  get(obj, field) {
2134
2153
  let val = obj[field];
2154
+ const temp = $mol_wire_task.getter(typeof val === 'function' ? val : get_prop(obj, field));
2135
2155
  if (typeof val !== 'function')
2136
- return val;
2137
- const temp = $mol_wire_task.getter(val);
2156
+ return temp(obj, []).sync();
2138
2157
  return function $mol_wire_sync(...args) {
2139
2158
  const fiber = temp(obj, args);
2140
2159
  return fiber.sync();
2141
2160
  };
2142
2161
  },
2162
+ set(obj, field, next) {
2163
+ const temp = $mol_wire_task.getter(get_prop(obj, field));
2164
+ temp(obj, [next]).sync();
2165
+ return true;
2166
+ },
2143
2167
  construct(obj, args) {
2144
2168
  const temp = $mol_wire_task.getter(factory(obj));
2145
2169
  return temp(obj, args).sync();