@hylid/call
Advanced tools
Comparing version 4.0.8 to 4.0.9
@@ -9,2 +9,6 @@ /// <reference types="miniprogram" /> | ||
export declare function call<T extends keyof MPApi>(name: T | ({} & string), options?: PickMPArgs<T> | Common | Callback<PickMpReturns<T>>, config?: Config): any; | ||
export declare function callAsync<T = any>(apiName: string, options?: AsyncCallback<T> & any, config?: { | ||
timeout: number; | ||
isSync?: boolean; | ||
}): Promise<any>; | ||
export declare function createWebviewSrc(url: string): string; | ||
@@ -11,0 +15,0 @@ export { WebViewBridge } from './webviewBridge'; |
@@ -1,2 +0,2 @@ | ||
var _a; | ||
var _a, _b; | ||
import { platform, PLATFORM } from '@hylid/env'; | ||
@@ -8,2 +8,3 @@ import { mpCall } from "./mpCall"; | ||
var callMap = (_a = {}, _a[PLATFORM.MP] = mpCall, _a[PLATFORM.MPWEB] = mpWebCall, _a[PLATFORM.WEB] = webCall, _a); | ||
var callMapAsync = (_b = {}, _b[PLATFORM.MPWEB] = mpWebCallAsync, _b[PLATFORM.WEB] = webCallAsync, _b); | ||
export function call(name, options, config) { | ||
@@ -16,2 +17,9 @@ if (platform) { | ||
} | ||
export function callAsync(apiName, options, config) { | ||
if (platform) { | ||
return callMapAsync[platform](apiName, options, config); | ||
} else { | ||
return Promise.reject(notFound(options, config)); | ||
} | ||
} | ||
export function createWebviewSrc(url) { | ||
@@ -18,0 +26,0 @@ var app = my.getSystemInfoSync().app; |
@@ -59,2 +59,5 @@ var __assign = this && this.__assign || function () { | ||
export function mpWebCall(api, options, config) { | ||
config = __assign({ | ||
timeout: 20000 | ||
}, config); | ||
var random = Math.floor(Math.random() * 1000000); | ||
@@ -61,0 +64,0 @@ var serialId = api + '_' + random; |
{ | ||
"name": "@hylid/call", | ||
"version": "4.0.8", | ||
"version": "4.0.9", | ||
"main": "lib/index.js", | ||
@@ -9,4 +9,4 @@ "files": [ | ||
"dependencies": { | ||
"@hylid/env": "^4.0.8", | ||
"@hylid/types": "^4.0.8" | ||
"@hylid/env": "^4.0.9", | ||
"@hylid/types": "^4.0.9" | ||
}, | ||
@@ -13,0 +13,0 @@ "publishConfig": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41960
1293
Updated@hylid/env@^4.0.9
Updated@hylid/types@^4.0.9