New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

coreh5sdk

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coreh5sdk

核心sdk

latest
npmnpm
Version
0.8.9
Version published
Maintainers
1
Created
Source

core-js

核心sdk接入js,已发到npm

功能简述

  • 含登陆回调、支付回调等
  • 以及所有需要与客户端交互的事件

安装依赖

npm i || yarn || cnpm

启动本地调试

无需调试

打包压缩

yarn build

项目结构

.
├── README.md  ------------------------ 说明文件
├── package.json  --------------------- 项目配置
├── rollup.config.js  ----------------- rollup打包配置
├── index.ts  ------------------------- 入口文件
├── DsBridge.ts  ---------------------- 所有方法
├── h5/xx  ---------------------------- iife风格
└── dist/xx  -------------------------- cjs风格    

使用

1. 核心平台通过js引入信息传递

渠道引入方式:

yarn add coresdk

import coresdk from 'coreh5sdk/dist/coreH5sdk'

Vue.prototype.$coresdk = new coresdk({})

2. api介绍

(1)登陆回调

const loginData = {
  externalData: {
    openId: parseInt(Math.random() * 10000000000000000)
  },
  internalData: {
    token: '4a3b62078b47a1eea21d4f5dada68516',
    register: true,
    floatMsg: '我是卷轴',
    floatUrl: location.origin + '/textScroll',
    redPoint: true
  }
}
this.$coresdk.callNative.loginSuccess(loginData)

(2)支付回调

this.$coresdk.callNative.transactionSuccess({
    status: true,
    amount: 100,
    orderId: '2345678765435678',
    paymentType: 'alipay'
})

(3)调用客户端的方法:

this.$coresdk.callNative[methods]()
methods:是以下的方法 ======>

详细客户端方法列表:http://gitlab.yslocal.com/fe/demo/dsbridge

常见问题说明

npm命名为coreH5sdk,因为core-js已经被占用

npm发包前一定先打包

npm发包后注意合master,保持代码一致性

FAQs

Package last updated on 17 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts