Browse Source

feat(ts) TypeScript enum for JitsiConnectionEvents

tags/v0.0.2
Gary Hunt 3 years ago
parent
commit
39a4514009
No account linked to committer's email address
3 changed files with 102 additions and 86 deletions
  1. 0
    47
      JitsiConnectionEvents.js
  2. 56
    0
      JitsiConnectionEvents.ts
  3. 46
    39
      types/auto/JitsiConnectionEvents.d.ts

+ 0
- 47
JitsiConnectionEvents.js View File

@@ -1,47 +0,0 @@
1
-/**
2
- * The events for the connection.
3
- */
4
-
5
-/**
6
- * Indicates that the connection has been disconnected. The event provides
7
- * the following parameters to its listeners:
8
- *
9
- * @param msg {string} a message associated with the disconnect such as the
10
- * last (known) error message
11
- */
12
-export const CONNECTION_DISCONNECTED = 'connection.connectionDisconnected';
13
-
14
-/**
15
- * Indicates that the connection has been established. The event provides
16
- * the following parameters to its listeners:
17
- *
18
- * @param id {string} the ID of the local endpoint/participant/peer (within
19
- * the context of the established connection)
20
- */
21
-export const CONNECTION_ESTABLISHED = 'connection.connectionEstablished';
22
-
23
-/**
24
- * Indicates that the connection has been failed for some reason. The event
25
- * provides the following parameters to its listeners:
26
- *
27
- * @param errType {JitsiConnectionErrors} the type of error associated with
28
- * the failure
29
- * @param errReason {string} the error (message) associated with the failure
30
- * @param credentials {object} the credentials used to connect (if any)
31
- * @param errReasonDetails {object} an optional object with details about
32
- * the error, like shard moving, suspending. Used for analytics purposes.
33
- */
34
-export const CONNECTION_FAILED = 'connection.connectionFailed';
35
-
36
-/**
37
- * Indicates that the performed action cannot be executed because the
38
- * connection is not in the correct state(connected, disconnected, etc.)
39
- */
40
-export const WRONG_STATE = 'connection.wrongState';
41
-
42
-/**
43
- * Indicates that the display name is required over this connection and need to be supplied when
44
- * joining the room.
45
- * There are cases like lobby room where display name is required.
46
- */
47
-export const DISPLAY_NAME_REQUIRED = 'connection.display_name_required';

+ 56
- 0
JitsiConnectionEvents.ts View File

@@ -0,0 +1,56 @@
1
+/**
2
+ * The events for the connection.
3
+ */
4
+
5
+export enum JitsiConnectionEvents {
6
+    /**
7
+     * Indicates that the connection has been disconnected. The event provides
8
+     * the following parameters to its listeners:
9
+     *
10
+     * @param msg {string} a message associated with the disconnect such as the
11
+     * last (known) error message
12
+     */
13
+    CONNECTION_DISCONNECTED = 'connection.connectionDisconnected',
14
+
15
+    /**
16
+     * Indicates that the connection has been established. The event provides
17
+     * the following parameters to its listeners:
18
+     *
19
+     * @param id {string} the ID of the local endpoint/participant/peer (within
20
+     * the context of the established connection)
21
+     */
22
+    CONNECTION_ESTABLISHED = 'connection.connectionEstablished',
23
+
24
+    /**
25
+     * Indicates that the connection has been failed for some reason. The event
26
+     * provides the following parameters to its listeners:
27
+     *
28
+     * @param errType {JitsiConnectionErrors} the type of error associated with
29
+     * the failure
30
+     * @param errReason {string} the error (message) associated with the failure
31
+     * @param credentials {object} the credentials used to connect (if any)
32
+     * @param errReasonDetails {object} an optional object with details about
33
+     * the error, like shard moving, suspending. Used for analytics purposes.
34
+     */
35
+    CONNECTION_FAILED = 'connection.connectionFailed',
36
+
37
+    /**
38
+     * Indicates that the performed action cannot be executed because the
39
+     * connection is not in the correct state(connected, disconnected, etc.)
40
+     */
41
+    WRONG_STATE = 'connection.wrongState',
42
+
43
+    /**
44
+     * Indicates that the display name is required over this connection and need to be supplied when
45
+     * joining the room.
46
+     * There are cases like lobby room where display name is required.
47
+     */
48
+    DISPLAY_NAME_REQUIRED = 'connection.display_name_required'
49
+};
50
+
51
+// exported for backward compatibility
52
+export const CONNECTION_DISCONNECTED = JitsiConnectionEvents.CONNECTION_DISCONNECTED;
53
+export const CONNECTION_ESTABLISHED = JitsiConnectionEvents.CONNECTION_ESTABLISHED;
54
+export const CONNECTION_FAILED = JitsiConnectionEvents.CONNECTION_FAILED;
55
+export const WRONG_STATE = JitsiConnectionEvents.WRONG_STATE;
56
+export const DISPLAY_NAME_REQUIRED = JitsiConnectionEvents.DISPLAY_NAME_REQUIRED;

+ 46
- 39
types/auto/JitsiConnectionEvents.d.ts View File

@@ -1,42 +1,49 @@
1 1
 /**
2 2
  * The events for the connection.
3 3
  */
4
-/**
5
- * Indicates that the connection has been disconnected. The event provides
6
- * the following parameters to its listeners:
7
- *
8
- * @param msg {string} a message associated with the disconnect such as the
9
- * last (known) error message
10
- */
11
-export const CONNECTION_DISCONNECTED: "connection.connectionDisconnected";
12
-/**
13
- * Indicates that the connection has been established. The event provides
14
- * the following parameters to its listeners:
15
- *
16
- * @param id {string} the ID of the local endpoint/participant/peer (within
17
- * the context of the established connection)
18
- */
19
-export const CONNECTION_ESTABLISHED: "connection.connectionEstablished";
20
-/**
21
- * Indicates that the connection has been failed for some reason. The event
22
- * provides the following parameters to its listeners:
23
- *
24
- * @param errType {JitsiConnectionErrors} the type of error associated with
25
- * the failure
26
- * @param errReason {string} the error (message) associated with the failure
27
- * @param credentials {object} the credentials used to connect (if any)
28
- * @param errReasonDetails {object} an optional object with details about
29
- * the error, like shard moving, suspending. Used for analytics purposes.
30
- */
31
-export const CONNECTION_FAILED: "connection.connectionFailed";
32
-/**
33
- * Indicates that the performed action cannot be executed because the
34
- * connection is not in the correct state(connected, disconnected, etc.)
35
- */
36
-export const WRONG_STATE: "connection.wrongState";
37
-/**
38
- * Indicates that the display name is required over this connection and need to be supplied when
39
- * joining the room.
40
- * There are cases like lobby room where display name is required.
41
- */
42
-export const DISPLAY_NAME_REQUIRED: "connection.display_name_required";
4
+export declare enum JitsiConnectionEvents {
5
+    /**
6
+     * Indicates that the connection has been disconnected. The event provides
7
+     * the following parameters to its listeners:
8
+     *
9
+     * @param msg {string} a message associated with the disconnect such as the
10
+     * last (known) error message
11
+     */
12
+    CONNECTION_DISCONNECTED = "connection.connectionDisconnected",
13
+    /**
14
+     * Indicates that the connection has been established. The event provides
15
+     * the following parameters to its listeners:
16
+     *
17
+     * @param id {string} the ID of the local endpoint/participant/peer (within
18
+     * the context of the established connection)
19
+     */
20
+    CONNECTION_ESTABLISHED = "connection.connectionEstablished",
21
+    /**
22
+     * Indicates that the connection has been failed for some reason. The event
23
+     * provides the following parameters to its listeners:
24
+     *
25
+     * @param errType {JitsiConnectionErrors} the type of error associated with
26
+     * the failure
27
+     * @param errReason {string} the error (message) associated with the failure
28
+     * @param credentials {object} the credentials used to connect (if any)
29
+     * @param errReasonDetails {object} an optional object with details about
30
+     * the error, like shard moving, suspending. Used for analytics purposes.
31
+     */
32
+    CONNECTION_FAILED = "connection.connectionFailed",
33
+    /**
34
+     * Indicates that the performed action cannot be executed because the
35
+     * connection is not in the correct state(connected, disconnected, etc.)
36
+     */
37
+    WRONG_STATE = "connection.wrongState",
38
+    /**
39
+     * Indicates that the display name is required over this connection and need to be supplied when
40
+     * joining the room.
41
+     * There are cases like lobby room where display name is required.
42
+     */
43
+    DISPLAY_NAME_REQUIRED = "connection.display_name_required"
44
+}
45
+export declare const CONNECTION_DISCONNECTED = JitsiConnectionEvents.CONNECTION_DISCONNECTED;
46
+export declare const CONNECTION_ESTABLISHED = JitsiConnectionEvents.CONNECTION_ESTABLISHED;
47
+export declare const CONNECTION_FAILED = JitsiConnectionEvents.CONNECTION_FAILED;
48
+export declare const WRONG_STATE = JitsiConnectionEvents.WRONG_STATE;
49
+export declare const DISPLAY_NAME_REQUIRED = JitsiConnectionEvents.DISPLAY_NAME_REQUIRED;

Loading…
Cancel
Save