@grapecity-software/js-collaboration-presence 18.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +1 -0
- package/package.json +32 -0
- package/wrapper.mjs +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# SpreadJS Collaboration Plugin
|
|
2
|
+
|
|
3
|
+
js collaboration presence 是 [SpreadJS](https://www.grapecity.com.cn/developer/spreadjs) 的插件之一
|
|
4
|
+
|
|
5
|
+
它通过增加 协同 支持,扩展了 SpreadJS 的功能。
|
|
6
|
+
|
|
7
|
+
有关 SpreadJS 模块和插件的详细列表,请参见 [SpreadJS 组件库](https://demo.grapecity.com.cn/spreadjs/help/docs/getstarted/modules)
|
|
8
|
+
|
|
9
|
+
## 安装模块/插件
|
|
10
|
+
```sh
|
|
11
|
+
npm install @grapecity-software/js-collaboration-presence
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 获取更多帮助
|
|
15
|
+
想需要获取更多产品信息,请浏览 [SpreadJS 主页](https://www.grapecity.com.cn/developer/spreadjs)
|
|
16
|
+
|
|
17
|
+
您可以在论坛中提出任何您使用产品过程中遇到的问题: [技术支持论坛](https://gcdn.grapecity.com.cn/showforum-232-1.html)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IFeature } from "@grapecity-software/js-collaboration";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Presence feature
|
|
5
|
+
* @example
|
|
6
|
+
* const httpServer = createServer();
|
|
7
|
+
* const server = new Server({ httpServer });
|
|
8
|
+
* server.useFeature(OT.documentFeature());
|
|
9
|
+
* server.useFeature(presenceFeature());
|
|
10
|
+
*/
|
|
11
|
+
export declare function presenceFeature(): IFeature;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,s){if("object"==typeof exports&&"object"==typeof module)module.exports=s();else if("function"==typeof define&&define.amd)define([],s);else{var r=s();for(var t in r)("object"==typeof exports?exports:e)[t]=r[t]}}(this,(()=>(()=>{"use strict";var e={658:(e,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PresenceManager=void 0,s.PresenceManager=class{constructor(){this._presences=new Map}get presences(){return this._presences}getPresence(e){return this._presences.get(e)}setPresence(e,s){this._presences.set(e,s)}removePresence(e){this._presences.delete(e)}}},17:(e,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Presence=void 0;const t=r(773);s.Presence=class{constructor(){this.presences={}}messageHandler(e,s){if("string"!=typeof s)return;const r=JSON.parse(s);switch(r.a){case t.Actions.update:this._handleUpdateMsg(e,r);break;case t.Actions.remove:this._handleRemoveMsg(e);break;case t.Actions.subscribe:this._handleSubscribeMsg(e)}}disconnect(e){this._handleRemoveMsg(e)}_handleUpdateMsg(e,s){if(!("presence"in s))return void this._handleRemoveMsg(e);const r=s.presence,n=(0,t.createPresences)([e.id],[r]);this._has(e.id)?(this.presences[e.id]=r,this._broadCast(e,{a:t.Actions.update,presences:n})):(this.presences[e.id]=r,this._broadCast(e,{a:t.Actions.add,presences:n}))}_handleSubscribeMsg(e){this._send(e,{a:t.Actions.subscribe,presences:this.presences})}_handleRemoveMsg(e){this._has(e.id)&&(delete this.presences[e.id],this._broadCast(e,{a:t.Actions.remove,presencesIds:[e.id]}))}_send(e,s){e.send(JSON.stringify(s),t.PRESENCE_MESSAGE_TYPE)}_broadCast(e,s){e.broadcast(JSON.stringify(s),t.PRESENCE_MESSAGE_TYPE,!0)}_has(e){return e in this.presences}}},773:(e,s)=>{var r;Object.defineProperty(s,"__esModule",{value:!0}),s.PRESENCE_MESSAGE_TYPE=s.Actions=void 0,s.createPresences=function(e,s){const r={};for(let t=0;t<e.length;t++)r[e[t]]=s[t];return r},function(e){e.subscribe="s",e.unsubscribe="u",e.update="d",e.add="a",e.remove="r"}(r||(s.Actions=r={})),s.PRESENCE_MESSAGE_TYPE="p"}},s={};function r(t){var n=s[t];if(void 0!==n)return n.exports;var o=s[t]={exports:{}};return e[t](o,o.exports,r),o.exports}var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.presenceFeature=function(e){return e=null!=e?e:new s.PresenceManager,{middlewares:{message:async(s,r)=>{var t;if(s.type!==o.PRESENCE_MESSAGE_TYPE)return await r();null===(t=e.getPresence(s.roomId))||void 0===t||t.messageHandler(s.connection,s.data)}},hooks:{createRoom:s=>{const r=new n.Presence;e.setPresence(s.roomId,r)},destroyRoom:s=>{e.removePresence(s.roomId)},leaveRoom:s=>{var r;null===(r=e.getPresence(s.roomId))||void 0===r||r.disconnect(s.connection)}}}};const s=r(658),n=r(17),o=r(773)})(),t})()));
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@grapecity-software/js-collaboration-presence",
|
|
3
|
+
"version": "18.0.0",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"import": "./wrapper.mjs",
|
|
9
|
+
"require": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"js-collaboration-presence",
|
|
13
|
+
"js-collaboration",
|
|
14
|
+
"collaboration",
|
|
15
|
+
"presence",
|
|
16
|
+
"spread",
|
|
17
|
+
"sheet",
|
|
18
|
+
"javascript",
|
|
19
|
+
"excel",
|
|
20
|
+
"spreadjs"
|
|
21
|
+
],
|
|
22
|
+
"author": {
|
|
23
|
+
"email": "info.xa@grapecity.com",
|
|
24
|
+
"name": "GrapeCity Software inc"
|
|
25
|
+
},
|
|
26
|
+
"license": "Commercial",
|
|
27
|
+
"description": "SpreadJS Collaboration plugin",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@grapecity-software/js-collaboration": "18.0.0"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "http://www.grapecity.com.cn/"
|
|
32
|
+
}
|