@agoric/internal 0.2.2-dev-324eee0.0 → 0.2.2-dev-f447e3a.0
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/package.json +3 -3
- package/src/callback.js +8 -8
- package/src/types.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/internal",
|
|
3
|
-
"version": "0.2.2-dev-
|
|
3
|
+
"version": "0.2.2-dev-f447e3a.0+f447e3a",
|
|
4
4
|
"description": "Externally unsupported utilities internal to agoric-sdk",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"lint:types": "tsc -p jsconfig.json"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@agoric/zone": "0.1.1-dev-
|
|
23
|
+
"@agoric/zone": "0.1.1-dev-f447e3a.0+f447e3a",
|
|
24
24
|
"@endo/far": "^0.2.14",
|
|
25
25
|
"@endo/marshal": "^0.8.1",
|
|
26
26
|
"@endo/promise-kit": "^0.2.52",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "f447e3a93d1cd19d73b1310158bc4eea4f8bd824"
|
|
42
42
|
}
|
package/src/callback.js
CHANGED
|
@@ -20,11 +20,11 @@ import { E } from '@endo/far';
|
|
|
20
20
|
* @returns {ReturnType<I>}
|
|
21
21
|
*/
|
|
22
22
|
export const callSync = (callback, ...args) => {
|
|
23
|
-
const { target,
|
|
24
|
-
if (
|
|
23
|
+
const { target, methodName, bound } = callback;
|
|
24
|
+
if (methodName === undefined) {
|
|
25
25
|
return target(...bound, ...args);
|
|
26
26
|
}
|
|
27
|
-
return target[
|
|
27
|
+
return target[methodName](...bound, ...args);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -36,11 +36,11 @@ export const callSync = (callback, ...args) => {
|
|
|
36
36
|
* @returns {Promise<Awaited<ReturnType<I>>>}
|
|
37
37
|
*/
|
|
38
38
|
export const callE = (callback, ...args) => {
|
|
39
|
-
const { target,
|
|
40
|
-
if (
|
|
39
|
+
const { target, methodName, bound } = callback;
|
|
40
|
+
if (methodName === undefined) {
|
|
41
41
|
return E(target)(...bound, ...args);
|
|
42
42
|
}
|
|
43
|
-
return E(target)[
|
|
43
|
+
return E(target)[methodName](...bound, ...args);
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
/**
|
|
@@ -95,7 +95,7 @@ harden(makeFunctionCallback);
|
|
|
95
95
|
*/
|
|
96
96
|
export const makeSyncMethodCallback = (target, methodName, ...bound) => {
|
|
97
97
|
/** @type {unknown} */
|
|
98
|
-
const cb = harden({ target,
|
|
98
|
+
const cb = harden({ target, methodName, bound });
|
|
99
99
|
return /** @type {SyncCallback<I>} */ (cb);
|
|
100
100
|
};
|
|
101
101
|
harden(makeSyncMethodCallback);
|
|
@@ -116,7 +116,7 @@ harden(makeSyncMethodCallback);
|
|
|
116
116
|
*/
|
|
117
117
|
export const makeMethodCallback = (target, methodName, ...bound) => {
|
|
118
118
|
/** @type {unknown} */
|
|
119
|
-
const cb = harden({ target,
|
|
119
|
+
const cb = harden({ target, methodName, bound });
|
|
120
120
|
return /** @type {Callback<I>} */ (cb);
|
|
121
121
|
};
|
|
122
122
|
harden(makeMethodCallback);
|