mol_plot_all 1.2.1322 → 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.mjs 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();
package/node.test.js CHANGED
@@ -2119,18 +2119,42 @@ var $;
2119
2119
  factories.set(val, make);
2120
2120
  return make;
2121
2121
  }
2122
+ const getters = new WeakMap();
2123
+ function get_prop(host, field) {
2124
+ let props = getters.get(host);
2125
+ let get_val = props?.[field];
2126
+ if (get_val)
2127
+ return get_val;
2128
+ get_val = (next) => {
2129
+ if (next !== undefined)
2130
+ host[field] = next;
2131
+ return host[field];
2132
+ };
2133
+ Object.defineProperty(get_val, 'name', { value: field });
2134
+ if (!props) {
2135
+ props = {};
2136
+ getters.set(host, props);
2137
+ }
2138
+ props[field] = get_val;
2139
+ return get_val;
2140
+ }
2122
2141
  function $mol_wire_sync(obj) {
2123
2142
  return new Proxy(obj, {
2124
2143
  get(obj, field) {
2125
2144
  let val = obj[field];
2145
+ const temp = $mol_wire_task.getter(typeof val === 'function' ? val : get_prop(obj, field));
2126
2146
  if (typeof val !== 'function')
2127
- return val;
2128
- const temp = $mol_wire_task.getter(val);
2147
+ return temp(obj, []).sync();
2129
2148
  return function $mol_wire_sync(...args) {
2130
2149
  const fiber = temp(obj, args);
2131
2150
  return fiber.sync();
2132
2151
  };
2133
2152
  },
2153
+ set(obj, field, next) {
2154
+ const temp = $mol_wire_task.getter(get_prop(obj, field));
2155
+ temp(obj, [next]).sync();
2156
+ return true;
2157
+ },
2134
2158
  construct(obj, args) {
2135
2159
  const temp = $mol_wire_task.getter(factory(obj));
2136
2160
  return temp(obj, args).sync();