dingtalk-jsapi
钉钉 模块化 多端统一 API
Last updated 3 months ago by ppz420 .
MIT · Original npm · Tarball · package.json
$ npm install dingtalk-jsapi 
SYNC missed versions from official npm registry.

钉钉多端统一jsapi

此 jsApi 支持运行于 android, ios, pc,钉钉小程序,小程序内嵌 webview 等钉钉全环境下,且保持开发体验一致。

安装

dingtalk-jsapi 现在可从 npm 上安装.

npm install dingtalk-jsapi

推荐使用npm包形式按需引入

新的特性

除了兼容现钉钉开放平台提供的jsapi的特性,还支持以下下特性

  1. 支持返回原生 Promise
  2. 支持模块化引入 api,模块化引入平台
  3. 支持 dd.checkJsApi, 用于检测当前环境是否支持此jsApi
  4. 提供 dd.on, dd.off来绑定事件,用于同一绑定事件
  5. 添加 dd.env 来读取当前环境变量
  6. 支持 typescript 的接口定义,接口定义还在持续添加中,如有纰漏欢迎反馈

使用介绍

整体调用

import * as dd from 'dingtalk-jsapi';
dd.device.notification.alert({
    message: "亲爱的",
    title: "提示",//可传空
    buttonName: "收到",
}).then(() => {
    //成功即相当于 onSuccess
}, () => {
    //失败即相当于 onFail
});

按需调用(占用体积小)

import 'dingtalk-jsapi/entry/mobile'; // 只引入移动端(支持小程序)
// import 'dingtalk-jsapi/entry/union'; // 如果你想要在此代码在PC端和移动端都执行,那你可以如此引入
import alert from 'dingtalk-jsapi/api/device/notification/alert'; // 按需引入方法

alert({
    message: "亲爱的",
    title: "提示",//可传空
    buttonName: "收到",
}).then(() => {
    //成功即相当于 onSuccess
}, () => {
    //失败即相当于 onFail
});

dd.ready优化

旧版本pc调用接口

//首先你鉴权需要权限
dd.config({
    agentId: '', // 必填,微应用ID
    corpId: '',//必填,企业ID
    timeStamp: , // 必填,生成签名的时间戳
    nonceStr: '', // 必填,生成签名的随机串
    signature: '', // 必填,签名
    type:0/1,   //选填,0表示微应用的jsapi,1表示服务窗的jsapi,不填默认为0。该参数从dingtalk.js的0.8.3版本开始支持
    jsApiList:[
        'biz.contact.choose',
    ],
});

//然后因为鉴权是异步的,所以你的方法需要包括在dd.ready, config校验完成后的钩子
dd.ready(() => {
    dd.device.notification.alert({
        message: "亲爱的",
        title: "提示",//可传空
        buttonName: "收到",
    }).then(() => {
        //成功即相当于 onSuccess
    }, () => {
        //失败即相当于 onFail
    });
})

新版本pc调用接口

dd.config({
    agentId: '', // 必填,微应用ID
    corpId: '',//必填,企业ID
    timeStamp: , // 必填,生成签名的时间戳
    nonceStr: '', // 必填,生成签名的随机串
    signature: '', // 必填,签名
    type:0/1,   //选填,0表示微应用的jsapi,1表示服务窗的jsapi,不填默认为0。该参数从dingtalk.js的0.8.3版本开始支持
    jsApiList:[
        'device.notification.alert',
    ],
});

// 优化后不再需要包括dd.ready,接口自动延后执行
dd.device.notification.alert({
    message: "亲爱的",
    title: "提示",//可传空
    buttonName: "收到",
}).then(() => {
    //成功即相当于 onSuccess
}, () => {
    //失败即相当于 onFail
});

反馈渠道

亲爱的开发者,为了更好的提高服务效率和问题沉淀,在开发过程中如果遇到问题,可以有以下方式获取技术支持: 【推荐】登录开发者后台,https://open-dev.dingtalk.com,在右下角有“在线帮助”(人工客服时间:工作日10:00~12:00,14:00~18:00, 19:00~21:00)

最终解释权归阿里巴巴钉钉事业部所有

Current Tags

  • 2.14.5-alpha.1                                ...           alpha (2 years ago)
  • 3.0.28-beta.1                                ...           beta (a year ago)
  • 3.0.38                                ...           latest (3 months ago)

196 Versions

  • 3.0.38                                ...           3 months ago
  • 3.0.36                                ...           5 months ago
  • 3.0.35                                ...           6 months ago
  • 3.0.33                                ...           7 months ago
  • 3.0.32                                ...           8 months ago
  • 3.0.31                                ...           10 months ago
  • 3.0.29                                ...           a year ago
  • 3.0.28                                ...           a year ago
  • 3.0.28-beta.1                                ...           a year ago
  • 3.0.28-beta.0                                ...           a year ago
  • 3.0.27                                ...           a year ago
  • 3.0.27-beta.0                                ...           a year ago
  • 3.0.26                                ...           a year ago
  • 3.0.25                                ...           a year ago
  • 3.0.24                                ...           a year ago
  • 3.0.23 [deprecated]           ...           a year ago
  • 3.0.22                                ...           a year ago
  • 3.0.22-beta.0                                ...           2 years ago
  • 3.0.20                                ...           2 years ago
  • 3.0.15                                ...           2 years ago
  • 3.0.14                                ...           2 years ago
  • 3.0.13                                ...           2 years ago
  • 3.0.12                                ...           2 years ago
  • 3.0.11                                ...           2 years ago
  • 3.1.0-beta.0                                ...           2 years ago
  • 3.0.10                                ...           2 years ago
  • 3.0.9                                ...           2 years ago
  • 3.0.7                                ...           2 years ago
  • 3.0.6                                ...           2 years ago
  • 3.0.5                                ...           2 years ago
  • 2.15.4                                ...           2 years ago
  • 3.0.3                                ...           2 years ago
  • 3.0.2 [deprecated]           ...           2 years ago
  • 2.15.3 [deprecated]           ...           2 years ago
  • 2.15.2                                ...           2 years ago
  • 2.15.1                                ...           2 years ago
  • 2.15.0                                ...           2 years ago
  • 2.14.3                                ...           2 years ago
  • 2.14.5-alpha.1                                ...           2 years ago
  • 2.14.2                                ...           2 years ago
  • 2.14.1                                ...           2 years ago
  • 2.14.0                                ...           2 years ago
  • 2.13.94                                ...           2 years ago
  • 2.13.100-alpha.12                                ...           3 years ago
  • 2.13.100-alpha.11                                ...           3 years ago
  • 2.13.100-alpha.10                                ...           3 years ago
  • 2.13.100-alpha.9                                ...           3 years ago
  • 2.13.100-alpha.8                                ...           3 years ago
  • 2.13.100-alpha.7                                ...           3 years ago
  • 2.13.92                                ...           3 years ago
  • 2.13.100-alpha.6                                ...           3 years ago
  • 2.13.100-alpha.5                                ...           3 years ago
  • 2.13.100-alpha.4                                ...           3 years ago
  • 2.13.100-alpha.3                                ...           3 years ago
  • 2.13.100-alpha.2                                ...           3 years ago
  • 2.13.100-alpha.1                                ...           3 years ago
  • 2.13.91                                ...           3 years ago
  • 2.13.71                                ...           3 years ago
  • 2.13.68                                ...           3 years ago
  • 2.13.61                                ...           3 years ago
  • 2.13.53                                ...           3 years ago
  • 2.13.51                                ...           3 years ago
  • 2.13.50                                ...           3 years ago
  • 2.13.43                                ...           3 years ago
  • 2.13.42                                ...           3 years ago
  • 2.13.41                                ...           3 years ago
  • 2.13.41-alpha.0                                ...           4 years ago
  • 2.13.40                                ...           4 years ago
  • 2.14.0-alpha.0                                ...           4 years ago
  • 2.13.37                                ...           4 years ago
  • 2.13.23                                ...           4 years ago
  • 2.13.20                                ...           4 years ago
  • 2.13.9                                ...           4 years ago
  • 2.13.7                                ...           4 years ago
  • 2.13.4                                ...           4 years ago
  • 2.13.3                                ...           4 years ago
  • 2.12.2                                ...           4 years ago
  • 2.12.1                                ...           4 years ago
  • 2.12.0                                ...           4 years ago
  • 2.11.25                                ...           4 years ago
  • 2.11.15                                ...           4 years ago
  • 2.11.10                                ...           4 years ago
  • 2.11.2                                ...           4 years ago
  • 2.10.3                                ...           5 years ago
  • 2.10.2                                ...           5 years ago
  • 2.10.1                                ...           5 years ago
  • 2.10.1-alpha.1                                ...           5 years ago
  • 2.10.1-alpha.0                                ...           5 years ago
  • 2.10.0 [deprecated]           ...           5 years ago
  • 2.9.14                                ...           5 years ago
  • 2.9.10                                ...           5 years ago
  • 2.8.33                                ...           5 years ago
  • 2.8.31                                ...           5 years ago
  • 2.8.11                                ...           5 years ago
  • 2.8.7                                ...           5 years ago
  • 2.8.5                                ...           5 years ago
  • 2.8.4                                ...           5 years ago
  • 2.7.6                                ...           5 years ago
  • 2.7.3                                ...           5 years ago
  • 2.6.44                                ...           6 years ago
  • 2.6.26                                ...           6 years ago
  • 2.6.22                                ...           6 years ago
  • 2.6.13                                ...           6 years ago
  • 2.6.0                                ...           6 years ago
  • 2.5.15                                ...           6 years ago
  • 2.5.14                                ...           6 years ago
  • 2.5.13                                ...           6 years ago
  • 2.5.10                                ...           6 years ago
  • 2.5.8                                ...           6 years ago
  • 2.5.4                                ...           6 years ago
  • 2.6.0-alpha.0                                ...           6 years ago
  • 2.5.1                                ...           6 years ago
  • 2.5.0                                ...           6 years ago
  • 2.4.15                                ...           6 years ago
  • 2.4.14                                ...           6 years ago
  • 2.4.12                                ...           6 years ago
  • 2.4.11                                ...           6 years ago
  • 2.4.9                                ...           6 years ago
  • 2.4.8                                ...           6 years ago
  • 2.4.7                                ...           6 years ago
  • 2.4.6                                ...           6 years ago
  • 2.4.4 [deprecated]           ...           6 years ago
  • 2.4.3 [deprecated]           ...           6 years ago
  • 2.3.2 [deprecated]           ...           6 years ago
  • 2.3.1 [deprecated]           ...           6 years ago
  • 2.3.0 [deprecated]           ...           6 years ago
  • 2.2.1 [deprecated]           ...           6 years ago
  • 2.2.0 [deprecated]           ...           6 years ago
  • 2.0.83 [deprecated]           ...           6 years ago
  • 2.0.81 [deprecated]           ...           6 years ago
  • 2.0.78 [deprecated]           ...           6 years ago
  • 2.0.77 [deprecated]           ...           6 years ago
  • 2.0.76 [deprecated]           ...           6 years ago
  • 2.0.75 [deprecated]           ...           6 years ago
  • 2.0.73 [deprecated]           ...           6 years ago
  • 2.0.72 [deprecated]           ...           6 years ago
  • 2.0.71 [deprecated]           ...           6 years ago
  • 2.0.70 [deprecated]           ...           6 years ago
  • 2.0.69 [deprecated]           ...           6 years ago
  • 2.0.67 [deprecated]           ...           6 years ago
  • 2.0.65 [deprecated]           ...           6 years ago
  • 2.0.64 [deprecated]           ...           6 years ago
  • 2.0.63 [deprecated]           ...           6 years ago
  • 2.0.62 [deprecated]           ...           6 years ago
  • 2.0.61 [deprecated]           ...           6 years ago
  • 2.0.60 [deprecated]           ...           6 years ago
  • 2.0.59 [deprecated]           ...           6 years ago
  • 2.0.58 [deprecated]           ...           6 years ago
  • 2.0.57 [deprecated]           ...           6 years ago
  • 2.0.56 [deprecated]           ...           6 years ago
  • 2.0.55 [deprecated]           ...           6 years ago
  • 2.0.54 [deprecated]           ...           6 years ago
  • 2.0.53 [deprecated]           ...           6 years ago
  • 2.0.52 [deprecated]           ...           6 years ago
  • 2.0.51 [deprecated]           ...           6 years ago
  • 2.0.50 [deprecated]           ...           6 years ago
  • 2.0.48 [deprecated]           ...           6 years ago
  • 2.0.47 [deprecated]           ...           6 years ago
  • 2.0.40 [deprecated]           ...           6 years ago
  • 2.0.37 [deprecated]           ...           6 years ago
  • 2.0.30 [deprecated]           ...           6 years ago
  • 2.0.29 [deprecated]           ...           6 years ago
  • 2.0.28 [deprecated]           ...           6 years ago
  • 2.0.26 [deprecated]           ...           7 years ago
  • 2.0.25 [deprecated]           ...           7 years ago
  • 2.0.22 [deprecated]           ...           7 years ago
  • 2.0.21 [deprecated]           ...           7 years ago
  • 2.0.20 [deprecated]           ...           7 years ago
  • 2.0.18 [deprecated]           ...           7 years ago
  • 2.0.17 [deprecated]           ...           7 years ago
  • 2.0.16 [deprecated]           ...           7 years ago
  • 2.0.15 [deprecated]           ...           7 years ago
  • 2.0.14 [deprecated]           ...           7 years ago
  • 2.0.13 [deprecated]           ...           7 years ago
  • 2.0.12 [deprecated]           ...           7 years ago
  • 2.0.11 [deprecated]           ...           7 years ago
  • 2.0.10 [deprecated]           ...           7 years ago
  • 2.0.9 [deprecated]           ...           7 years ago
  • 2.0.8 [deprecated]           ...           7 years ago
  • 2.0.7 [deprecated]           ...           7 years ago
  • 2.0.6 [deprecated]           ...           7 years ago
  • 2.0.5 [deprecated]           ...           7 years ago
  • 2.0.4 [deprecated]           ...           7 years ago
  • 2.0.3 [deprecated]           ...           7 years ago
  • 2.0.2 [deprecated]           ...           7 years ago
  • 2.0.1 [deprecated]           ...           7 years ago
  • 2.0.0 [deprecated]           ...           7 years ago
  • 0.0.11 [deprecated]           ...           7 years ago
  • 0.0.10 [deprecated]           ...           7 years ago
  • 0.0.9 [deprecated]           ...           7 years ago
  • 0.0.8 [deprecated]           ...           7 years ago
  • 0.0.7 [deprecated]           ...           7 years ago
  • 0.0.6 [deprecated]           ...           7 years ago
  • 0.0.5 [deprecated]           ...           7 years ago
  • 0.0.3 [deprecated]           ...           7 years ago
  • 0.0.1 [deprecated]           ...           7 years ago
Downloads
Total 193
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 11
Dependencies (1)
Dev Dependencies (0)
None
Dependents (0)
None

© 2010 - cnpmjs.org x YWFE | Home | YWFE