inge-bridge
v0.0.8
Published
miniprogram bridge of multiple platform
Downloads
2
Readme
miniprogram-bridge
接口
// 导出features下所有的接口
export default {
version,
init,
services: {
...ad,
...addUserRole,
...game,
...login,
...logout,
...pay,
...share
}
}
init
export function init(options: IOptions): void;
utils/configure
export const configure = {
// 初始化操作
init,
get,
setUserId,
getUserId,
setChannelCode,
getChannelCode,
setToken,
getToken
}
utils/env
export const platform;
export const sourceChannel;
export const bridge;
export function getMiniPlatform(): string;
export function getSourceChannel(): string;
export function getMiniBridge(): any;
enum
export const PLATFORM = {
ALIPAY: 'alipay',
TAO_BAO: 'taobao',
UNKNOWN: 'unknown'
}
export const SYSTEM = {
IOS: 'iOS',
ANDROID: 'Android',
HARMONY: 'Harmony',
UNKNOWN: 'unknown'
}
如何使用
import Inge, { platform, PLATFORM } from 'miniprogram-bridge'
Inge.init({
env: 'test',
alipayOptions: {
...
},
taobaoOptions: {
...
}
})
if (platform === PLATFORM.ALIPAY) {
Inge.services.login()
}
if (platform === PLATFORM.TAOBAO) {
Inge.services.logout()
}
参考工程
# https://github.com/lihaizhong/miniprogram-bridge-test
git clone [email protected]:lihaizhong/miniprogram-bridge-test.git