hackchat-engine 1.1.14 → 1.1.15

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/Client.js CHANGED
@@ -442,6 +442,17 @@ class Client extends EventEmitter {
442
442
 
443
443
  this.ws.send(payload);
444
444
  }
445
+
446
+ /**
447
+ * Unsubscribe from a channel
448
+ * @param {string} channel The channel to leave
449
+ */
450
+ leave(channel) {
451
+ this.ws.send({
452
+ cmd: OPCodes.LEAVE,
453
+ channel: channel || this.channel, // @todo Multichannel
454
+ });
455
+ }
445
456
  }
446
457
 
447
458
  export default Client;
package/package.json CHANGED
@@ -59,5 +59,5 @@
59
59
  "lintfix": "eslint --fix --ignore-path .gitignore .",
60
60
  "test": "echo \"Error: no test specified\" && exit 1"
61
61
  },
62
- "version": "1.1.14"
62
+ "version": "1.1.15"
63
63
  }
package/util/Constants.js CHANGED
@@ -60,6 +60,7 @@ export const Status = {
60
60
  export const OPCodes = {
61
61
  SESSION: 'session',
62
62
  JOIN: 'join',
63
+ LEAVE: 'leave',
63
64
  CHAT: 'chat',
64
65
  INVITE: 'invite',
65
66
  CHANGE_NICK: 'changenick',
@@ -85,9 +85,9 @@ class SocketHandler extends EventEmitter {
85
85
  /**
86
86
  * Store new client session id when assigned
87
87
  */
88
- this.client.on(Events.SESSION, (data) =>
89
- this.sessionID = data.token,
90
- );
88
+ this.client.on(Events.SESSION, (data) => {
89
+ this.sessionID = data.token;
90
+ });
91
91
 
92
92
  // Initiate connection
93
93
  this.connect(gateway);