@hylid/call 3.2.5 → 3.3.0-alpha.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/lib/mpCall.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export function mpCall(apiName, options, config) {
2
2
  var _a = (config || {}).type,
3
3
  type = _a === void 0 ? 'async' : _a;
4
- if (type === 'sync') {
4
+ if (type === 'sync' || (config === null || config === void 0 ? void 0 : config.isSync)) {
5
5
  // @ts-ignore
6
6
  return my[apiName](options);
7
7
  }
package/lib/mpWebCall.js CHANGED
@@ -56,7 +56,8 @@ export function mpWebCall(api, options, config) {
56
56
  api: api,
57
57
  serialId: serialId,
58
58
  options: options,
59
- config: config
59
+ config: config,
60
+ isSync: config === null || config === void 0 ? void 0 : config.isSync
60
61
  };
61
62
  mpWebPostMessage(message);
62
63
  }
package/lib/types.d.ts CHANGED
@@ -2,6 +2,10 @@ import { JsApiType, MPApi, PickMPArgs, PickMpReturns } from '@hylid/types';
2
2
  export declare type JsApi = keyof MPApi;
3
3
  export interface JsApiConfig {
4
4
  type?: JsApiType;
5
+ /**
6
+ * @deprecated 优先使用 type = "sync" 配置
7
+ */
8
+ isSync?: boolean;
5
9
  }
6
10
  export declare type Config = JsApiConfig;
7
11
  export interface MpWebMessageResult<T = any> {
@@ -16,6 +20,10 @@ export interface MpWebJsApiMessage {
16
20
  options: any;
17
21
  config?: JsApiConfig;
18
22
  result?: MpWebMessageResult;
23
+ /**
24
+ * @deprecated 优先使用 config.type = "sync" 配置
25
+ */
26
+ isSync?: boolean;
19
27
  }
20
28
  export interface MpWebBroadcastMessage {
21
29
  source: 'hylid';
@@ -180,7 +180,7 @@ export var getApiResult = function getApiResult(jsapi, data) {
180
180
  return __generator(this, function (_b) {
181
181
  api = data.api, options = data.options, config = data.config;
182
182
  _a = (config || {}).type, type = _a === void 0 ? 'async' : _a;
183
- if (type === 'sync') {
183
+ if (type === 'sync' || data.isSync) {
184
184
  return [2 /*return*/, getSyncApi(api, jsapi, options)];
185
185
  }
186
186
  if (type === 'async') {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@hylid/call",
3
- "version": "3.2.5",
3
+ "version": "3.3.0-alpha.0",
4
4
  "main": "lib/index.js",
5
5
  "files": [
6
6
  "lib"
7
7
  ],
8
8
  "dependencies": {
9
- "@hylid/env": "^3.2.5",
10
- "@hylid/types": "^3.2.5"
9
+ "@hylid/env": "^3.3.0-alpha.0",
10
+ "@hylid/types": "^3.3.0-alpha.0"
11
11
  },
12
12
  "publishConfig": {
13
13
  "access": "public"
@@ -15,4 +15,4 @@
15
15
  "license": "MIT",
16
16
  "sideEffects": false,
17
17
  "registry": "https://registry.npmjs.org/"
18
- }
18
+ }