@enonic-types/lib-websocket 0.1.1 → 7.11.0-B3

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.
Files changed (3) hide show
  1. package/README.md +4 -4
  2. package/package.json +33 -32
  3. package/websocket.d.ts +57 -57
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm i --save-dev @enonic/lib-websocket
8
+ npm i --save-dev @enonic-types/lib-websocket
9
9
  ```
10
10
 
11
11
  ## Use
@@ -26,8 +26,8 @@ Add the corresponding types to your `tsconfig.json` file that is used for applic
26
26
 
27
27
  ### Require and custom imports
28
28
 
29
- To make `require` work out of box, you must install and add the `@enonic-types/global` types. Aside from providing definitions for XP global
30
- objects, e.g. `log`, `app`, `__`, etc, requiring library by the default path will return typed object.
29
+ To make `require` work out of the box, you must install and add the `@enonic-types/global` types. Aside from providing definitions for XP
30
+ global objects, e.g. `log`, `app`, `__`, etc, requiring a library by the default path will return typed object.
31
31
 
32
32
  `tsconfig.json`
33
33
 
@@ -49,7 +49,7 @@ const {addToGroup, removeFromGroup, send, sendToGroup, getGroupSize} = require('
49
49
  ```
50
50
 
51
51
  More detailed explanation on how it works and how to type custom import function can be
52
- found [here](https://github.com/enonic/xp/tree/master/modules/lib/typescript/README.md).
52
+ found [here](https://developer.enonic.com/docs/xp/stable/api).
53
53
 
54
54
  ### ES6-style import
55
55
 
package/package.json CHANGED
@@ -1,32 +1,33 @@
1
- {
2
- "name": "@enonic-types/lib-websocket",
3
- "version": "0.1.1",
4
- "description": "Type definitions for lib-websocket.",
5
- "types": "websocket.d.ts",
6
- "files": [
7
- "websocket.d.ts"
8
- ],
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/enonic/xp.git#master"
12
- },
13
- "keywords": [
14
- "enonic",
15
- "enonic-xp",
16
- "lib-websocket",
17
- "websocket",
18
- "types",
19
- "typescript"
20
- ],
21
- "contributors": [
22
- "Mikita Taukachou <edloidas@gmail.com> (https://edloidas.github.io/)"
23
- ],
24
- "license": "Apache-2.0",
25
- "bugs": {
26
- "url": "https://github.com/enonic/xp/issues"
27
- },
28
- "homepage": "https://github.com/enonic/xp/tree/master#readme",
29
- "publishConfig": {
30
- "access": "public"
31
- }
32
- }
1
+ {
2
+ "name": "@enonic-types/lib-websocket",
3
+ "version": "7.11.0-B3",
4
+ "description": "Type definitions for lib-websocket.",
5
+ "types": "websocket.d.ts",
6
+ "files": [
7
+ "websocket.d.ts"
8
+ ],
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/enonic/xp.git#master"
12
+ },
13
+ "keywords": [
14
+ "enonic",
15
+ "enonic-xp",
16
+ "lib-websocket",
17
+ "websocket",
18
+ "types",
19
+ "typescript"
20
+ ],
21
+ "contributors": [
22
+ "Mikita Taukachou <edloidas@gmail.com> (https://edloidas.github.io/)"
23
+ ],
24
+ "license": "Apache-2.0",
25
+ "bugs": {
26
+ "url": "https://github.com/enonic/xp/issues"
27
+ },
28
+ "homepage": "https://github.com/enonic/xp/tree/master#readme",
29
+ "dependencies": {},
30
+ "publishConfig": {
31
+ "access": "public"
32
+ }
33
+ }
package/websocket.d.ts CHANGED
@@ -1,57 +1,57 @@
1
- /**
2
- * Websocket functions.
3
- *
4
- * @example
5
- * var webSocketLib = require('/lib/xp/websocket');
6
- *
7
- * @module websocket
8
- */
9
- declare global {
10
- interface XpLibraries {
11
- '/lib/xp/websocket': typeof import('./websocket');
12
- }
13
- }
14
- /**
15
- * Add an id to a socket group.
16
- *
17
- * @example-ref examples/websocket/addToGroup.js
18
- *
19
- * @param {string} group Group name.
20
- * @param {string} id Socket id.
21
- */
22
- export declare function addToGroup(group: string, id: string): void;
23
- /**
24
- * Remove an id from a socket group.
25
- *
26
- * @example-ref examples/websocket/removeFromGroup.js
27
- *
28
- * @param {string} group Group name.
29
- * @param {string} id Socket id.
30
- */
31
- export declare function removeFromGroup(group: string, id: string): void;
32
- /**
33
- * Send message directly to a socket id.
34
- *
35
- * @example-ref examples/websocket/send.js
36
- *
37
- * @param {string} id Socket id.
38
- * @param {string} message Message as text.
39
- */
40
- export declare function send(id: string, message: string): void;
41
- /**
42
- * Send message to all sockets in group.
43
- *
44
- * @example-ref examples/websocket/sendToGroup.js
45
- *
46
- * @param {string} group Group name.
47
- * @param {string} message Message as text.
48
- */
49
- export declare function sendToGroup(group: string, message: string): void;
50
- /**
51
- * Get number of all sockets in group.
52
- *
53
- * @example-ref examples/websocket/addToGroup.js
54
- *
55
- * @param {string} group Group name.
56
- */
57
- export declare function getGroupSize(group: string): number;
1
+ /**
2
+ * Websocket functions.
3
+ *
4
+ * @example
5
+ * var webSocketLib = require('/lib/xp/websocket');
6
+ *
7
+ * @module websocket
8
+ */
9
+ declare global {
10
+ interface XpLibraries {
11
+ '/lib/xp/websocket': typeof import('./websocket');
12
+ }
13
+ }
14
+ /**
15
+ * Add an id to a socket group.
16
+ *
17
+ * @example-ref examples/websocket/addToGroup.js
18
+ *
19
+ * @param {string} group Group name.
20
+ * @param {string} id Socket id.
21
+ */
22
+ export declare function addToGroup(group: string, id: string): void;
23
+ /**
24
+ * Remove an id from a socket group.
25
+ *
26
+ * @example-ref examples/websocket/removeFromGroup.js
27
+ *
28
+ * @param {string} group Group name.
29
+ * @param {string} id Socket id.
30
+ */
31
+ export declare function removeFromGroup(group: string, id: string): void;
32
+ /**
33
+ * Send message directly to a socket id.
34
+ *
35
+ * @example-ref examples/websocket/send.js
36
+ *
37
+ * @param {string} id Socket id.
38
+ * @param {string} message Message as text.
39
+ */
40
+ export declare function send(id: string, message: string): void;
41
+ /**
42
+ * Send message to all sockets in group.
43
+ *
44
+ * @example-ref examples/websocket/sendToGroup.js
45
+ *
46
+ * @param {string} group Group name.
47
+ * @param {string} message Message as text.
48
+ */
49
+ export declare function sendToGroup(group: string, message: string): void;
50
+ /**
51
+ * Get number of all sockets in group.
52
+ *
53
+ * @example-ref examples/websocket/addToGroup.js
54
+ *
55
+ * @param {string} group Group name.
56
+ */
57
+ export declare function getGroupSize(group: string): number;