mol_crypto_lib 0.1.1442 → 0.1.1444
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.deps.json +1 -1
- package/node.js +26 -2
- package/node.js.map +1 -1
- package/node.mjs +26 -2
- package/node.test.js +26 -2
- package/node.test.js.map +1 -1
- package/package.json +1 -1
package/node.mjs
CHANGED
@@ -1946,18 +1946,42 @@ var $;
|
|
1946
1946
|
factories.set(val, make);
|
1947
1947
|
return make;
|
1948
1948
|
}
|
1949
|
+
const getters = new WeakMap();
|
1950
|
+
function get_prop(host, field) {
|
1951
|
+
let props = getters.get(host);
|
1952
|
+
let get_val = props?.[field];
|
1953
|
+
if (get_val)
|
1954
|
+
return get_val;
|
1955
|
+
get_val = (next) => {
|
1956
|
+
if (next !== undefined)
|
1957
|
+
host[field] = next;
|
1958
|
+
return host[field];
|
1959
|
+
};
|
1960
|
+
Object.defineProperty(get_val, 'name', { value: field });
|
1961
|
+
if (!props) {
|
1962
|
+
props = {};
|
1963
|
+
getters.set(host, props);
|
1964
|
+
}
|
1965
|
+
props[field] = get_val;
|
1966
|
+
return get_val;
|
1967
|
+
}
|
1949
1968
|
function $mol_wire_sync(obj) {
|
1950
1969
|
return new Proxy(obj, {
|
1951
1970
|
get(obj, field) {
|
1952
1971
|
let val = obj[field];
|
1972
|
+
const temp = $mol_wire_task.getter(typeof val === 'function' ? val : get_prop(obj, field));
|
1953
1973
|
if (typeof val !== 'function')
|
1954
|
-
return
|
1955
|
-
const temp = $mol_wire_task.getter(val);
|
1974
|
+
return temp(obj, []).sync();
|
1956
1975
|
return function $mol_wire_sync(...args) {
|
1957
1976
|
const fiber = temp(obj, args);
|
1958
1977
|
return fiber.sync();
|
1959
1978
|
};
|
1960
1979
|
},
|
1980
|
+
set(obj, field, next) {
|
1981
|
+
const temp = $mol_wire_task.getter(get_prop(obj, field));
|
1982
|
+
temp(obj, [next]).sync();
|
1983
|
+
return true;
|
1984
|
+
},
|
1961
1985
|
construct(obj, args) {
|
1962
1986
|
const temp = $mol_wire_task.getter(factory(obj));
|
1963
1987
|
return temp(obj, args).sync();
|
package/node.test.js
CHANGED
@@ -1937,18 +1937,42 @@ var $;
|
|
1937
1937
|
factories.set(val, make);
|
1938
1938
|
return make;
|
1939
1939
|
}
|
1940
|
+
const getters = new WeakMap();
|
1941
|
+
function get_prop(host, field) {
|
1942
|
+
let props = getters.get(host);
|
1943
|
+
let get_val = props?.[field];
|
1944
|
+
if (get_val)
|
1945
|
+
return get_val;
|
1946
|
+
get_val = (next) => {
|
1947
|
+
if (next !== undefined)
|
1948
|
+
host[field] = next;
|
1949
|
+
return host[field];
|
1950
|
+
};
|
1951
|
+
Object.defineProperty(get_val, 'name', { value: field });
|
1952
|
+
if (!props) {
|
1953
|
+
props = {};
|
1954
|
+
getters.set(host, props);
|
1955
|
+
}
|
1956
|
+
props[field] = get_val;
|
1957
|
+
return get_val;
|
1958
|
+
}
|
1940
1959
|
function $mol_wire_sync(obj) {
|
1941
1960
|
return new Proxy(obj, {
|
1942
1961
|
get(obj, field) {
|
1943
1962
|
let val = obj[field];
|
1963
|
+
const temp = $mol_wire_task.getter(typeof val === 'function' ? val : get_prop(obj, field));
|
1944
1964
|
if (typeof val !== 'function')
|
1945
|
-
return
|
1946
|
-
const temp = $mol_wire_task.getter(val);
|
1965
|
+
return temp(obj, []).sync();
|
1947
1966
|
return function $mol_wire_sync(...args) {
|
1948
1967
|
const fiber = temp(obj, args);
|
1949
1968
|
return fiber.sync();
|
1950
1969
|
};
|
1951
1970
|
},
|
1971
|
+
set(obj, field, next) {
|
1972
|
+
const temp = $mol_wire_task.getter(get_prop(obj, field));
|
1973
|
+
temp(obj, [next]).sync();
|
1974
|
+
return true;
|
1975
|
+
},
|
1952
1976
|
construct(obj, args) {
|
1953
1977
|
const temp = $mol_wire_task.getter(factory(obj));
|
1954
1978
|
return temp(obj, args).sync();
|