larasopp 1.0.6 → 1.0.7
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/package.json +1 -1
- package/src/Core.ts +4 -0
- package/src/Subscribe.ts +3 -5
- package/src/index.ts +4 -2
package/package.json
CHANGED
package/src/Core.ts
CHANGED
|
@@ -12,6 +12,10 @@ export type TListenerCallback = (data:{channel: string}) => void;
|
|
|
12
12
|
|
|
13
13
|
export type TPermissions = 'public' | 'protected' | 'private';
|
|
14
14
|
|
|
15
|
+
export type TBind = {
|
|
16
|
+
remove: () => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
15
19
|
export type TMessage<T> = {
|
|
16
20
|
subscribe?: string;
|
|
17
21
|
unsubscribe?: string;
|
package/src/Subscribe.ts
CHANGED
|
@@ -2,16 +2,14 @@ import {
|
|
|
2
2
|
TMessage,
|
|
3
3
|
ListenerEvents,
|
|
4
4
|
TListenerEvents,
|
|
5
|
-
TListenerCallback
|
|
5
|
+
TListenerCallback,
|
|
6
|
+
TBind
|
|
6
7
|
} from "./Core";
|
|
7
8
|
import {
|
|
8
9
|
Event,
|
|
9
10
|
Events
|
|
10
11
|
} from "easy-event-emitter";
|
|
11
12
|
|
|
12
|
-
type TReturn = {
|
|
13
|
-
remove: () => void;
|
|
14
|
-
}
|
|
15
13
|
|
|
16
14
|
interface ISubscribe {
|
|
17
15
|
events: Events;
|
|
@@ -65,7 +63,7 @@ class Subscribe {
|
|
|
65
63
|
}
|
|
66
64
|
}
|
|
67
65
|
|
|
68
|
-
public bind<T>(event: string, callback: (data: T) => void):
|
|
66
|
+
public bind<T>(event: string, callback: (data: T) => void): TBind {
|
|
69
67
|
const Event = this.events.addListener(this.channel + ':' + event, callback);
|
|
70
68
|
return {
|
|
71
69
|
remove: () => {
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,8 @@ import Core,{
|
|
|
6
6
|
TPermissions,
|
|
7
7
|
SocketEvents,
|
|
8
8
|
TSocketEvents,
|
|
9
|
-
TListenerCallback
|
|
9
|
+
TListenerCallback,
|
|
10
|
+
TBind
|
|
10
11
|
} from "./Core";
|
|
11
12
|
import Subscribe from "./Subscribe";
|
|
12
13
|
|
|
@@ -76,7 +77,8 @@ class Larasopp extends Core {
|
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
export type {
|
|
79
|
-
Subscribe
|
|
80
|
+
Subscribe,
|
|
81
|
+
TBind
|
|
80
82
|
};
|
|
81
83
|
|
|
82
84
|
export default Larasopp;
|