@hylid/call
Advanced tools
Comparing version 4.0.7 to 4.0.8-alpha.1
@@ -12,2 +12,3 @@ var __assign = this && this.__assign || function () { | ||
import { mpWebOnMessage, mpWebPostMessage } from "./mpWebBridge"; | ||
import { createError } from "./utils"; | ||
import { alipayJSBridge } from "./webCall"; | ||
@@ -75,2 +76,11 @@ // 关联 postMessage 和 onMessage,根据 serialId 执行回调 | ||
mpWebPostMessage(message); | ||
// 设置 jsapi 通信超时时间 | ||
var _options = options; | ||
if ((config === null || config === void 0 ? void 0 : config.timeout) && (_options === null || _options === void 0 ? void 0 : _options.fail)) { | ||
setTimeout(function () { | ||
if (!callMap[serialId]) return; | ||
delete callMap[serialId]; | ||
_options.fail(createError('TIMEOUT')); | ||
}, config.timeout); | ||
} | ||
} | ||
@@ -77,0 +87,0 @@ function broadcastGlobalData(key, result) { |
@@ -10,3 +10,3 @@ import { JsApiType, MPApi, PickMPArgs, PickMpReturns } from '@hylid/types'; | ||
/** | ||
* timeout 配置,单位 ms | ||
* 套壳 jsapi 调用,通信超时时间。type = "callback" 时不生效 | ||
*/ | ||
@@ -13,0 +13,0 @@ timeout?: number; |
@@ -23,2 +23,6 @@ import { MpWebMessageResult } from './types'; | ||
}; | ||
TIMEOUT: { | ||
code: number; | ||
message: (name: string) => string; | ||
}; | ||
}; | ||
@@ -25,0 +29,0 @@ export declare const createError: (type: keyof typeof ERROR, name?: string) => { |
@@ -31,2 +31,8 @@ var ERROR = { | ||
} | ||
}, | ||
TIMEOUT: { | ||
code: -6, | ||
message: function message(name) { | ||
return "".concat(name, " exec fail, timeout"); | ||
} | ||
} | ||
@@ -33,0 +39,0 @@ }; |
{ | ||
"name": "@hylid/call", | ||
"version": "4.0.7", | ||
"version": "4.0.8-alpha.1", | ||
"main": "lib/index.js", | ||
@@ -9,4 +9,4 @@ "files": [ | ||
"dependencies": { | ||
"@hylid/env": "^4.0.7", | ||
"@hylid/types": "^4.0.7" | ||
"@hylid/env": "^4.0.8-alpha.1", | ||
"@hylid/types": "^4.0.8-alpha.1" | ||
}, | ||
@@ -13,0 +13,0 @@ "publishConfig": { |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
41367
1277
2
Updated@hylid/env@^4.0.8-alpha.1
Updated@hylid/types@^4.0.8-alpha.1