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

hylid-bridge

Package Overview
Dependencies
Maintainers
1
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hylid-bridge - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

lib/common/init-mp-web-channel.d.ts

2

lib/appEnv.d.ts

@@ -10,4 +10,4 @@ interface AppEnv {

declare let appEnv: AppEnv;
declare function setAppEnv(config: AppEnv | (() => AppEnv)): void;
export default appEnv;
declare function setAppEnv(_: AppEnv): void;
export { appEnv, setAppEnv };

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

import { callbackFn, loadAppxBridge, upFirst } from './common/utils';
import * as mpWebCnApis from './clients/mp-web/cn';
import * as mpWebIntlAPis from './clients/mp-web/intl';
import { upFirst } from './common/utils';
import initMpWebChannel from './common/init-mp-web-channel';
var clientType = [{

@@ -62,3 +61,5 @@ name: 'mp_web_intl',

var key = 'is' + name.split('_').map(upFirst).join('');
result[key] = name === client;
var current = name === client;
result[key] = current;
if (current) console.log("Note: your code is running at " + key);
return result;

@@ -69,40 +70,12 @@ }, {});

var appEnv = getEnv();
export default appEnv;
function setAppEnv(_) {
appEnv = _;
function setAppEnv(config) {
appEnv = typeof config === 'function' ? config() : config;
if (appEnv.isMpWebCn || appEnv.isMpWebIntl) {
initMpWebChannel();
}
}
export { appEnv, setAppEnv };
if (appEnv.isMpWebCn || appEnv.isMpWebIntl) {
var env_1 = window;
var originalMessageHandler_1;
var handleMiniProgramAPIMessage_1 = function handleMiniProgramAPIMessage_1(message) {
var serialId = message.serialId;
var data = message.result;
if (serialId) {
var callback = env_1.miniProgramAPICallbackArray[serialId];
callbackFn(data, callback);
delete env_1.miniProgramAPICallbackArray[serialId];
} else if (originalMessageHandler_1) {
originalMessageHandler_1 === null || originalMessageHandler_1 === void 0 ? void 0 : originalMessageHandler_1(message);
}
};
env_1.miniProgramAPICallbackArray = {};
env_1.JSBRIDGE_WAITING_QUEUE = [];
loadAppxBridge(function () {
if (env_1.my.onMessage) {
originalMessageHandler_1 = env_1.my.onMessage;
}
env_1.my.onMessage = function (message) {
handleMiniProgramAPIMessage_1(message);
};
Object.assign(my, appEnv.isMpWebCn ? mpWebCnApis : mpWebIntlAPis);
});
}
export default appEnv;
export { appEnv, setAppEnv };
import { PickMPArgs, PickMpReturns, MPApi } from '../types';
declare type Callback<T> = (result?: T) => void;
export default function call<T extends keyof MPApi>(apiName: T, options?: PickMPArgs<T> | Callback<PickMpReturns<T>>, callback?: Callback<PickMpReturns<T>>, isSync?: boolean): void;
export default function call<T extends keyof MPApi>(apiName: T, options?: PickMPArgs<T> | Callback<PickMpReturns<T>>, isSync?: boolean): void;
export {};

@@ -7,3 +7,2 @@ import { loadAppxBridge } from './utils';

options = _a.options,
callback = _a.callback,
isSync = _a.isSync;

@@ -23,3 +22,2 @@ var env = window;

options: options,
callback: callback,
isSync: isSync

@@ -29,3 +27,3 @@ });

export default function call(apiName, options, callback, isSync) {
export default function call(apiName, options, isSync) {
loadAppxBridge(function (bridgeReady) {

@@ -45,3 +43,2 @@ var env = window;

options: options,
callback: callback,
isSync: isSync

@@ -53,3 +50,2 @@ });

options: options,
callback: callback,
isSync: isSync

@@ -56,0 +52,0 @@ });

@@ -6,5 +6,5 @@ // @ts-nocheck

var getAppIdSync = function getAppIdSync(options) {
call('getAppIdSync', options, {}, true);
call('getAppIdSync', options, true);
};
export default getAppIdSync;

@@ -14,4 +14,3 @@ /// <reference types="miniprogram" />

export declare const loadAppxBridge: (cb?: Function | undefined) => void;
export declare const log: (msg?: any) => void;
export declare const upFirst: (word: string) => string;
export declare const isIOS: boolean;
export declare const upFirst: (word: string) => string;

@@ -86,10 +86,6 @@ import { BridgeReady } from './constants';

};
export var log = function log(msg) {
var testdiv = document.getElementById('test');
if (testdiv) {
var div = document.createElement('div');
div.innerHTML = msg || '';
testdiv.appendChild(div);
}
export var upFirst = function upFirst(word) {
return word.replace(/^([a-z])/, function (_, __) {
return __.toUpperCase();
});
};

@@ -102,7 +98,2 @@ export var isIOS = function () {

}
}();
export var upFirst = function upFirst(word) {
return word.replace(/^([a-z])/, function (_, __) {
return __.toUpperCase();
});
};
}();
import * as bridge from './bridges';
import webCall from './common/web-call';
import mpWebCall from './common/mp-web-call';
import initMpWebChannel from './common/init-mp-web-channel';
export * from './bridges';
export default bridge;
export { webCall, mpWebCall };
export { appEnv, setAppEnv } from './appEnv';
export { appEnv, setAppEnv } from './appEnv';
initMpWebChannel();
{
"name": "hylid-bridge",
"version": "1.0.3",
"version": "1.0.4",
"main": "lib/index.js",

@@ -5,0 +5,0 @@ "description": "Unite Api For AliPay Plus MiniProgram Project.",

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