Browse Source

feat(ts) migrate strophe.logger to TS

dev0
Yash 6 months ago
parent
commit
0b8e4e3ba1
No account linked to committer's email address
1 changed files with 11 additions and 5 deletions
  1. 11
    5
      modules/xmpp/strophe.logger.ts

modules/xmpp/strophe.logger.js → modules/xmpp/strophe.logger.ts View File

2
 
2
 
3
 import ConnectionPlugin from './ConnectionPlugin';
3
 import ConnectionPlugin from './ConnectionPlugin';
4
 
4
 
5
+
5
 /**
6
 /**
6
  *  Logs raw stanzas and makes them available for download as JSON
7
  *  Logs raw stanzas and makes them available for download as JSON
7
  */
8
  */
8
 class StropheLogger extends ConnectionPlugin {
9
 class StropheLogger extends ConnectionPlugin {
10
+    /**
11
+     *
12
+     */
13
+    private log: any;
14
+
9
     /**
15
     /**
10
      *
16
      *
11
      */
17
      */
18
      *
24
      *
19
      * @param connection
25
      * @param connection
20
      */
26
      */
21
-    init(connection) {
27
+    init(connection: Strophe.Connection): void {
22
         super.init(connection);
28
         super.init(connection);
23
-        this.connection.rawInput = this.logIncoming.bind(this);
24
-        this.connection.rawOutput = this.logOutgoing.bind(this);
29
+        connection.rawInput = this.logIncoming.bind(this);
30
+        connection.rawOutput = this.logOutgoing.bind(this);
25
     }
31
     }
26
 
32
 
27
     /**
33
     /**
28
      *
34
      *
29
      * @param stanza
35
      * @param stanza
30
      */
36
      */
31
-    logIncoming(stanza) {
37
+    logIncoming(stanza: Element | Strophe.Builder): void {
32
         this.log.push([ new Date().getTime(), 'incoming', stanza ]);
38
         this.log.push([ new Date().getTime(), 'incoming', stanza ]);
33
     }
39
     }
34
 
40
 
36
      *
42
      *
37
      * @param stanza
43
      * @param stanza
38
      */
44
      */
39
-    logOutgoing(stanza) {
45
+    logOutgoing(stanza: Element | Strophe.Builder): void {
40
         this.log.push([ new Date().getTime(), 'outgoing', stanza ]);
46
         this.log.push([ new Date().getTime(), 'outgoing', stanza ]);
41
     }
47
     }
42
 }
48
 }

Loading…
Cancel
Save