Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hylid/call

Package Overview
Dependencies
Maintainers
0
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hylid/call - npm Package Compare versions

Comparing version 4.0.0-alpha.18 to 4.0.0-alpha.19

1

lib/index.js

@@ -27,5 +27,4 @@ var _a;

}
;
export { WebViewBridge } from "./webviewBridge";
export { mpCall, mpWebCall, webCall, notFound, mpWebCallAsync, webCallAsync };
export { promisify } from "./promisify";

38

lib/mpWebCall.js

@@ -141,9 +141,39 @@ var __assign = this && this.__assign || function () {

var messageHandler = function messageHandler(message) {
var _a;
var serialId = message.serialId;
if (!serialId) return;
if (!callMap[serialId]) return;
var callback = callMap[serialId];
var data = message.result;
if (serialId) {
var callback = callMap[serialId];
callbackFn(data, callback);
delete callMap[serialId];
var type = (_a = message.config) === null || _a === void 0 ? void 0 : _a.type;
if (type === 'callback') {
var _b = data || {},
_data_2 = _b._data_,
_type_2 = _b._type_;
if (_type_2 === 'success') return callback(_data_2);
return callback(undefined, _data_2);
}
var _c = callback || {},
success = _c.success,
fail = _c.fail,
complete = _c.complete;
var _d = data || {},
_data_ = _d._data_,
_type_ = _d._type_;
// 新版本协议
if (_type_) {
if (_type_ === 'success') success === null || success === void 0 ? void 0 : success(_data_);
if (_type_ === 'fail') fail === null || fail === void 0 ? void 0 : fail(_data_);
complete === null || complete === void 0 ? void 0 : complete(_data_);
} else {
// 下面兼容老版本(老版本消息识别不明确,导致 H5 中走 success/fail 逻辑可能岔了)
// @ts-ignore
if (data === null || data === void 0 ? void 0 : data.error) {
fail === null || fail === void 0 ? void 0 : fail(data);
} else {
success === null || success === void 0 ? void 0 : success(data);
}
complete === null || complete === void 0 ? void 0 : complete(data);
}
delete callMap[serialId];
};

@@ -150,0 +180,0 @@ // 代码参考:https://alex.alipay.com/antcode/qianyu.fzy/af-appx/blob/r20191223-1.24.0/src/web-view/embed/index.tsx

@@ -1,4 +0,3 @@

import { AliJsApi } from '@hylid/types';
import { AliJsApi, AsyncCallback } from '@hylid/types';
import { JsApiConfig } from './types';
import { AsyncCallback } from '@hylid/types';
export declare const alipayJSBridge: (cb: Function) => any;

@@ -5,0 +4,0 @@ export declare function webCall<T extends keyof AliJsApi.Api>(apiName: T | ({} & string), options?: any, config?: JsApiConfig): void;

{
"name": "@hylid/call",
"version": "4.0.0-alpha.18",
"version": "4.0.0-alpha.19",
"main": "lib/index.js",

@@ -9,4 +9,4 @@ "files": [

"dependencies": {
"@hylid/env": "^4.0.0-alpha.18",
"@hylid/types": "^4.0.0-alpha.18"
"@hylid/env": "^4.0.0-alpha.19",
"@hylid/types": "^4.0.0-alpha.19"
},

@@ -13,0 +13,0 @@ "publishConfig": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc