@hylid/call 4.0.0-alpha.6 → 4.0.0-alpha.7

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.
@@ -1,4 +1,5 @@
1
1
  export interface Options {
2
2
  success?: (res: any) => void;
3
+ fail?: (res: any) => void;
3
4
  }
4
5
  export declare const promisify: <T extends Options, P = Parameters<Required<Options> & T["success"]>[0]>(fn: (opt: T) => void) => (args?: T | undefined) => Promise<P>;
package/lib/promisify.js CHANGED
@@ -12,8 +12,16 @@ export var promisify = function promisify(fn) {
12
12
  return function (args) {
13
13
  return new Promise(function (resolve, reject) {
14
14
  var options = __assign(__assign({}, args), {
15
- success: resolve,
16
- fail: reject
15
+ success: function success(opt) {
16
+ var _a;
17
+ resolve(opt);
18
+ (_a = args === null || args === void 0 ? void 0 : args.success) === null || _a === void 0 ? void 0 : _a.call(args, opt);
19
+ },
20
+ fail: function fail(opt) {
21
+ var _a;
22
+ reject(opt);
23
+ (_a = args === null || args === void 0 ? void 0 : args.fail) === null || _a === void 0 ? void 0 : _a.call(args, opt);
24
+ }
17
25
  });
18
26
  fn(options);
19
27
  });
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@hylid/call",
3
- "version": "4.0.0-alpha.6",
3
+ "version": "4.0.0-alpha.7",
4
4
  "main": "lib/index.js",
5
5
  "files": [
6
6
  "lib"
7
7
  ],
8
8
  "dependencies": {
9
- "@hylid/env": "^4.0.0-alpha.6",
10
- "@hylid/types": "^4.0.0-alpha.6"
9
+ "@hylid/env": "^4.0.0-alpha.7",
10
+ "@hylid/types": "^4.0.0-alpha.7"
11
11
  },
12
12
  "publishConfig": {
13
13
  "access": "public"