Bladeren bron

feat(ts) migrate strophe.logger to TS

dev0
Yash 6 maanden geleden
bovenliggende
commit
0b8e4e3ba1
No account linked to committer's email address
1 gewijzigde bestanden met toevoegingen van 11 en 5 verwijderingen
  1. 11
    5
      modules/xmpp/strophe.logger.ts

modules/xmpp/strophe.logger.js → modules/xmpp/strophe.logger.ts Bestand weergeven

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

Laden…
Annuleren
Opslaan