diff --git a/docs/guide/config.md b/docs/guide/config.md index f847327..c03224f 100644 --- a/docs/guide/config.md +++ b/docs/guide/config.md @@ -1169,6 +1169,16 @@ The hook functions are uniformly configured under ʻoptions.hook`, and configura ------------ +## Cooperative + +### cooperativeMessage + +- Type:Function +- Default:null +- Usage:Receive the cooperation message, secondary development. Expanding cooperative message instruction set +- Params: + - {Object} : Receives the entire collaboration message body object sent by the server + ## Image ### imageInsertBefore diff --git a/docs/zh/guide/config.md b/docs/zh/guide/config.md index f5d6816..6283601 100644 --- a/docs/zh/guide/config.md +++ b/docs/zh/guide/config.md @@ -1470,6 +1470,18 @@ Luckysheet开放了更细致的自定义配置选项,分别有 - {Number} [canvasHeight]: 滚动容器的高度 ------------ + + +## 协作消息 + +### cooperativeMessage + +- 类型:Function +- 默认值:null +- 作用:接受协作消息,二次开发。拓展协作消息指令集 +- 参数: + - {Object} : 收到服务器发送的整个协作消息体对象 + ## 图片 ### imageInsertBefore diff --git a/src/controllers/server.js b/src/controllers/server.js index 8bdfbc3..4d228fa 100644 --- a/src/controllers/server.js +++ b/src/controllers/server.js @@ -20,6 +20,7 @@ import dayjs from "dayjs"; import json from '../global/json'; import luckysheetConfigsetting from './luckysheetConfigsetting'; import {customImageUpdate} from './imageUpdateCtrl'; +import method from '../global/method'; const server = { gridKey: null, @@ -199,6 +200,7 @@ const server = { _this.websocket.onmessage = function(result){ Store.result = result let data = new Function("return " + result.data)(); + method.createHookFunction('cooperativeMessage', data) console.info(data); let type = data.type; let {message,id} = data;