larasopp 1.0.7 → 1.0.9

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/lib/Core.d.ts CHANGED
@@ -7,6 +7,9 @@ export type TListenerCallback = (data: {
7
7
  channel: string;
8
8
  }) => void;
9
9
  export type TPermissions = 'public' | 'protected' | 'private';
10
+ export type TBind = {
11
+ remove: () => void;
12
+ };
10
13
  export type TMessage<T> = {
11
14
  subscribe?: string;
12
15
  unsubscribe?: string;
@@ -1,8 +1,5 @@
1
- import { TMessage, TListenerEvents, TListenerCallback } from "./Core";
1
+ import { TMessage, TListenerEvents, TListenerCallback, TBind } from "./Core";
2
2
  import { Event, Events } from "easy-event-emitter";
3
- type TReturn = {
4
- remove: () => void;
5
- };
6
3
  interface ISubscribe {
7
4
  events: Events;
8
5
  hasChannel: (channel: string) => boolean;
@@ -23,7 +20,7 @@ declare class Subscribe {
23
20
  constructor({ events, hasChannel, pushChannel, removeChannel, status, channel, send }: ISubscribe);
24
21
  get channel(): string;
25
22
  private init;
26
- bind<T>(event: string, callback: (data: T) => void): TReturn;
23
+ bind<T>(event: string, callback: (data: T) => void): TBind;
27
24
  remove(): void;
28
25
  addListener(event: TListenerEvents, callback: TListenerCallback): Event | undefined;
29
26
  }
package/lib/Subscribe.js CHANGED
@@ -76,7 +76,6 @@ class Subscribe {
76
76
  const Event = this.events.addListener(this.channel + ':' + event, callback);
77
77
  return {
78
78
  remove: () => {
79
- this.remove();
80
79
  Event.remove();
81
80
  }
82
81
  };
package/lib/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Event } from "easy-event-emitter";
2
- import Core, { IConfig, TPermissions, TSocketEvents, TListenerCallback } from "./Core";
2
+ import Core, { IConfig, TPermissions, TSocketEvents, TListenerCallback, TBind } from "./Core";
3
3
  import Subscribe from "./Subscribe";
4
4
  declare class Larasopp extends Core {
5
5
  private _channels;
@@ -12,5 +12,5 @@ declare class Larasopp extends Core {
12
12
  hasChannel(channel: string): boolean;
13
13
  addListener(event: TSocketEvents, callback: TListenerCallback): Event | undefined;
14
14
  }
15
- export type { Subscribe };
15
+ export type { Subscribe, TBind };
16
16
  export default Larasopp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "larasopp",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Websocket client for laravel",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/src/Subscribe.ts CHANGED
@@ -67,7 +67,6 @@ class Subscribe {
67
67
  const Event = this.events.addListener(this.channel + ':' + event, callback);
68
68
  return {
69
69
  remove: () => {
70
- this.remove();
71
70
  Event.remove();
72
71
  }
73
72
  }