与插件保持长连接,使插件能够随时发消息给前端。
import { MicCore } from "@yl/super-jssdk"
MicCore.connect()
| 参数 | 类型 | 作用 |
|---|---|---|
| resolve(result) | Function | 成功回调,长连接会话接收回调函数.result为数组。数组第一个下标是code码,第二下标是回调参数 |
| reject(err) | Function | 失败回调,err为详细错误信息,是一个json对象,例如:{"errCode":-1,"errMsg":"出错啦"} |
code码,回调参数列表说明
| code码 | 说明 | 参数回调 |
|---|---|---|
| 102 | 广告页面点击事件 | mads广告插件传进来的params原样回调给前端 |
| 103 | 广告页面点击跳过按钮事件 | mads广告插件传进来的params原样回调给前端 |
| 104 | 涂鸦切换画笔颜色事件 | 返回int类型, 1:红色 2:黄色 3:白色 |
| 105 | 涂鸦画笔事件 | 无参数 |
| 106 | 涂鸦撤销画笔事件 | 无参数 |
| 107 | 重新拍照事件 | 无参数 |
| 108 | 涂鸦添加文字事件 | 无参数 |
MicCore.connect()
.then((res) => {
console.log(res);
})
.catch(err => {
console.log('插件调用失败:', err)
})