🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

hymd-store-jsapi

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hymd-store-jsapi

酷店掌移动端jsapi

latest
npmnpm
Version
1.12.7
Version published
Maintainers
1
Created
Source

cool-sdk

使用

api接口的使用必须在页面中引入如下脚本:

npm install @cool/sdk --save

运行时环境

指令

接口api

接口api是对不同环境的接口的集合,统一使用native调用

通用api

通过api就是这个api在每个环境中都可以使用,区别于特定api,比如previewImage就是通用api,每个环境都有,createDing就是特定api,只有钉钉环境有

参考

  • 钉钉相关api
  • 微信相关api
  • app相关api
  • pc相关api

注意

  • 目前只能访问原生能力的方法,不能访问属性
  • 每一个原生方法都需要有回调
  • 返回值暂时不能支持promise
  • 通用api,比如previewImage,需要在参数中添加isNative这个属性
    • 通用接口重写一下(h5有得,原生也有的,原生重写下)
  • 企业微信初始化配置暂时需要自己配置,未来会进行封装
  • 调用企业微信相关api,此api必须得注册好
  • 必须将router对象挂载在window中, window.router = router

todoList

  • 发布自动更新版本及生成版本记录
  • 支持promise
  • 原生路由和h5功能
  • 企业微信初始化封装
  • 支持配置及并发上传图片, 配置上传地址等
  • api接口测试预览(使用代理嵌入到原生环境中)
  • 调用传参和响应日志能力
  • 初始化自动加载jsbridge脚本功能
  • 编辑图片功能
  • ts类型文件
  • 全局变量冲突,比如window.dd.onMessage 与 window['getCommonData'], window.addEventListener("message")导致jsapi与项目的数据返回不正常

FQA

  • 通信的全局变量冲突, 如何兼容, 暂时需要库里面的通信监听, 通过外部监听
    // 兼容app
     window['getCommonData'] = function(res) {
       cool.handleMessage?.(res)
       if (res.action === type) {
         // 安卓或ios结果与钉钉一致
         const result = paramsResultMapping(type, res)
         result.callbackId = callbackId
         successCbk(result);
       }
     };
    // 兼容dingding
    window.dd && (window.dd.onMessage = (data) => {
      // 
      cool.handleMessage?.(data)
    })
    // 兼容PC
    

Keywords

lib

FAQs

Package last updated on 29 Feb 2024

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