@slickgrid-universal/event-pub-sub 0.19.2 → 1.2.1
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/CHANGELOG.md +49 -1
- package/LICENSE +1 -1
- package/dist/commonjs/eventPubSub.service.d.ts +31 -13
- package/dist/commonjs/eventPubSub.service.js +86 -34
- package/dist/commonjs/eventPubSub.service.js.map +1 -1
- package/dist/esm/eventPubSub.service.d.ts +31 -13
- package/dist/esm/eventPubSub.service.js +86 -34
- package/dist/esm/eventPubSub.service.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,46 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [
|
|
6
|
+
## [1.2.1](https://github.com/ghiscoding/slickgrid-universal/compare/v1.2.0...v1.2.1) (2022-01-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **memory:** clear & dispose of grid to avoid mem leaks & detached elm ([7035db5](https://github.com/ghiscoding/slickgrid-universal/commit/7035db5f878187f6fb8b9d2effacb7443f25e2c9))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [1.2.0](https://github.com/ghiscoding/slickgrid-universal/compare/v1.1.1...v1.2.0) (2022-01-06)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **services:** unsubscribe shouldn't remove when poping out of array ([e841da9](https://github.com/ghiscoding/slickgrid-universal/commit/e841da9df7a23bf7b789e4a13803488ab479ff15))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **binding:** make Binding Service a little smarter ([98a7661](https://github.com/ghiscoding/slickgrid-universal/commit/98a766173638246b6a17e31812929a9bba1eb52b))
|
|
28
|
+
* **services:** add extra features to EventPubSub Service ([9bd02b5](https://github.com/ghiscoding/slickgrid-universal/commit/9bd02b5d92bcf6aaf89a828c4e6496a24e795c53))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## [1.1.1](https://github.com/ghiscoding/slickgrid-universal/compare/v1.1.0...v1.1.1) (2021-12-11)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
* **build:** bump version manually bcoz of previous force push ([5e9a610](https://github.com/ghiscoding/slickgrid-universal/commit/5e9a610ad01d752673856591f9b5de73b0ece0e9))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# [1.1.0](https://github.com/ghiscoding/slickgrid-universal/compare/v0.19.2...v1.1.0) (2021-12-11)
|
|
7
46
|
|
|
8
47
|
**Note:** Version bump only for package @slickgrid-universal/event-pub-sub
|
|
9
48
|
|
|
@@ -12,6 +51,15 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
12
51
|
|
|
13
52
|
|
|
14
53
|
|
|
54
|
+
## [0.19.2](https://github.com/ghiscoding/slickgrid-universal/compare/v0.19.1...v0.19.2) (2021-11-19)
|
|
55
|
+
|
|
56
|
+
**Note:** Version bump only for package @slickgrid-universal/event-pub-sub
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
15
63
|
## [0.19.1](https://github.com/ghiscoding/slickgrid-universal/compare/v0.19.0...v0.19.1) (2021-11-15)
|
|
16
64
|
|
|
17
65
|
**Note:** Version bump only for package @slickgrid-universal/event-pub-sub
|
package/LICENSE
CHANGED
|
@@ -1,15 +1,35 @@
|
|
|
1
|
-
import { EventNamingStyle, EventSubscription, PubSubService } from '@slickgrid-universal/common';
|
|
2
|
-
interface PubSubEvent {
|
|
1
|
+
import { EventNamingStyle, EventSubscription, PubSubService, Subscription } from '@slickgrid-universal/common';
|
|
2
|
+
export interface PubSubEvent<T = any> {
|
|
3
3
|
name: string;
|
|
4
|
-
listener: (event: CustomEventInit) => void;
|
|
4
|
+
listener: (event: T | CustomEventInit<T>) => void;
|
|
5
5
|
}
|
|
6
6
|
export declare class EventPubSubService implements PubSubService {
|
|
7
7
|
protected _elementSource: Element;
|
|
8
8
|
protected _subscribedEvents: PubSubEvent[];
|
|
9
|
+
protected _timer: any;
|
|
9
10
|
eventNamingStyle: EventNamingStyle;
|
|
11
|
+
get elementSource(): Element;
|
|
12
|
+
set elementSource(element: Element);
|
|
10
13
|
get subscribedEvents(): PubSubEvent[];
|
|
11
14
|
get subscribedEventNames(): string[];
|
|
12
15
|
constructor(elementSource?: Element);
|
|
16
|
+
dispose(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Dispatch of Custom Event, which by default will bubble up & is cancelable
|
|
19
|
+
* @param {String} eventName - event name to dispatch
|
|
20
|
+
* @param {*} data - optional data to include in the dispatching
|
|
21
|
+
* @param {Boolean} isBubbling - is the event bubbling up?
|
|
22
|
+
* @param {Boolean} isCancelable - is the event cancellable?
|
|
23
|
+
* @returns {Boolean} returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
|
|
24
|
+
*/
|
|
25
|
+
dispatchCustomEvent<T = any>(eventName: string, data?: T, isBubbling?: boolean, isCancelable?: boolean): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Get the event name by the convention defined, it could be: all lower case, camelCase, PascalCase or kebab-case
|
|
28
|
+
* @param {String} inputEventName - name of the event
|
|
29
|
+
* @param {String} eventNamePrefix - prefix to use in the event name
|
|
30
|
+
* @returns {String} - output event name
|
|
31
|
+
*/
|
|
32
|
+
getEventNameByNamingConvention(inputEventName: string, eventNamePrefix: string): string;
|
|
13
33
|
/**
|
|
14
34
|
* Method to publish a message via a dispatchEvent.
|
|
15
35
|
* Return is a Boolean (from the event dispatch) unless a delay is provided if so we'll return the dispatched event in a Promise with a delayed cycle
|
|
@@ -28,7 +48,7 @@ export declare class EventPubSubService implements PubSubService {
|
|
|
28
48
|
* @param callback The callback to be invoked when the specified message is published.
|
|
29
49
|
* @return possibly a Subscription
|
|
30
50
|
*/
|
|
31
|
-
subscribe<T = any>(eventName: string, callback: (data:
|
|
51
|
+
subscribe<T = any>(eventName: string, callback: (data: T) => void): Subscription;
|
|
32
52
|
/**
|
|
33
53
|
* Subscribes to a custom event message channel or message type.
|
|
34
54
|
* This is similar to the "subscribe" except that the callback receives an event typed as CustomEventInit and the data will be inside its "event.detail"
|
|
@@ -36,18 +56,16 @@ export declare class EventPubSubService implements PubSubService {
|
|
|
36
56
|
* @param callback The callback to be invoked when the specified message is published.
|
|
37
57
|
* @return possibly a Subscription
|
|
38
58
|
*/
|
|
39
|
-
subscribeEvent<T = any>(eventName: string, listener: (event: CustomEventInit<T>) => void):
|
|
59
|
+
subscribeEvent<T = any>(eventName: string, listener: (event: CustomEventInit<T>) => void): Subscription;
|
|
40
60
|
/**
|
|
41
61
|
* Unsubscribes a message name
|
|
42
|
-
* @param event
|
|
62
|
+
* @param {String} event - the event name
|
|
63
|
+
* @param {*} listener - event listener callback
|
|
64
|
+
* @param {Boolean} shouldRemoveFromEventList - should we also remove the event from the subscriptions array?
|
|
43
65
|
* @return possibly a Subscription
|
|
44
66
|
*/
|
|
45
|
-
unsubscribe(eventName: string, listener: (event: CustomEventInit) => void): void;
|
|
46
|
-
/** Unsubscribes all subscriptions that currently exists */
|
|
67
|
+
unsubscribe<T = any>(eventName: string, listener: (event: T | CustomEventInit<T>) => void, shouldRemoveFromEventList?: boolean): void;
|
|
68
|
+
/** Unsubscribes all subscriptions/events that currently exists */
|
|
47
69
|
unsubscribeAll(subscriptions?: EventSubscription[]): void;
|
|
48
|
-
|
|
49
|
-
dispatchCustomEvent<T = any>(eventName: string, data?: T, isBubbling?: boolean, isCancelable?: boolean): boolean;
|
|
50
|
-
/** Get the event name by the convention defined, it could be: all lower case, camelCase, PascalCase or kebab-case */
|
|
51
|
-
getEventNameByNamingConvention(inputEventName: string, eventNamePrefix: string): string;
|
|
70
|
+
protected removeSubscribedEventWhenFound<T>(eventName: string, listener: (event: T | CustomEventInit<T>) => void): void;
|
|
52
71
|
}
|
|
53
|
-
export {};
|
|
@@ -10,12 +10,66 @@ class EventPubSubService {
|
|
|
10
10
|
// or create a "phantom DOM node" (a div element that is never rendered) to set up a custom event dispatching
|
|
11
11
|
this._elementSource = elementSource || document.createElement('div');
|
|
12
12
|
}
|
|
13
|
+
get elementSource() {
|
|
14
|
+
return this._elementSource;
|
|
15
|
+
}
|
|
16
|
+
set elementSource(element) {
|
|
17
|
+
this._elementSource = element;
|
|
18
|
+
}
|
|
13
19
|
get subscribedEvents() {
|
|
14
20
|
return this._subscribedEvents;
|
|
15
21
|
}
|
|
16
22
|
get subscribedEventNames() {
|
|
17
23
|
return this._subscribedEvents.map((pubSubEvent) => pubSubEvent.name);
|
|
18
24
|
}
|
|
25
|
+
dispose() {
|
|
26
|
+
var _a;
|
|
27
|
+
this.unsubscribeAll();
|
|
28
|
+
this._subscribedEvents = [];
|
|
29
|
+
clearTimeout(this._timer);
|
|
30
|
+
(_a = this._elementSource) === null || _a === void 0 ? void 0 : _a.remove();
|
|
31
|
+
this._elementSource = null;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Dispatch of Custom Event, which by default will bubble up & is cancelable
|
|
35
|
+
* @param {String} eventName - event name to dispatch
|
|
36
|
+
* @param {*} data - optional data to include in the dispatching
|
|
37
|
+
* @param {Boolean} isBubbling - is the event bubbling up?
|
|
38
|
+
* @param {Boolean} isCancelable - is the event cancellable?
|
|
39
|
+
* @returns {Boolean} returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
|
|
40
|
+
*/
|
|
41
|
+
dispatchCustomEvent(eventName, data, isBubbling = true, isCancelable = true) {
|
|
42
|
+
var _a;
|
|
43
|
+
const eventInit = { bubbles: isBubbling, cancelable: isCancelable };
|
|
44
|
+
if (data) {
|
|
45
|
+
eventInit.detail = data;
|
|
46
|
+
}
|
|
47
|
+
return (_a = this._elementSource) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new CustomEvent(eventName, eventInit));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get the event name by the convention defined, it could be: all lower case, camelCase, PascalCase or kebab-case
|
|
51
|
+
* @param {String} inputEventName - name of the event
|
|
52
|
+
* @param {String} eventNamePrefix - prefix to use in the event name
|
|
53
|
+
* @returns {String} - output event name
|
|
54
|
+
*/
|
|
55
|
+
getEventNameByNamingConvention(inputEventName, eventNamePrefix) {
|
|
56
|
+
let outputEventName = '';
|
|
57
|
+
switch (this.eventNamingStyle) {
|
|
58
|
+
case common_1.EventNamingStyle.camelCase:
|
|
59
|
+
outputEventName = (eventNamePrefix !== '') ? `${eventNamePrefix}${(0, common_1.titleCase)(inputEventName)}` : inputEventName;
|
|
60
|
+
break;
|
|
61
|
+
case common_1.EventNamingStyle.kebabCase:
|
|
62
|
+
outputEventName = (eventNamePrefix !== '') ? `${eventNamePrefix}-${(0, common_1.toKebabCase)(inputEventName)}` : (0, common_1.toKebabCase)(inputEventName);
|
|
63
|
+
break;
|
|
64
|
+
case common_1.EventNamingStyle.lowerCase:
|
|
65
|
+
outputEventName = `${eventNamePrefix}${inputEventName}`.toLowerCase();
|
|
66
|
+
break;
|
|
67
|
+
case common_1.EventNamingStyle.lowerCaseWithoutOnPrefix:
|
|
68
|
+
outputEventName = `${eventNamePrefix}${inputEventName.replace(/^on/, '')}`.toLowerCase();
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
return outputEventName;
|
|
72
|
+
}
|
|
19
73
|
/**
|
|
20
74
|
* Method to publish a message via a dispatchEvent.
|
|
21
75
|
* Return is a Boolean (from the event dispatch) unless a delay is provided if so we'll return the dispatched event in a Promise with a delayed cycle
|
|
@@ -31,8 +85,7 @@ class EventPubSubService {
|
|
|
31
85
|
const eventNameByConvention = this.getEventNameByNamingConvention(eventName, '');
|
|
32
86
|
if (delay) {
|
|
33
87
|
return new Promise(resolve => {
|
|
34
|
-
|
|
35
|
-
setTimeout(() => resolve(isDispatched), delay);
|
|
88
|
+
this._timer = setTimeout(() => resolve(this.dispatchCustomEvent(eventNameByConvention, data, true, true)), delay);
|
|
36
89
|
});
|
|
37
90
|
}
|
|
38
91
|
else {
|
|
@@ -51,6 +104,10 @@ class EventPubSubService {
|
|
|
51
104
|
// basically we substitute the "data" with "event.detail" so that the user ends up with only the "data" result
|
|
52
105
|
this._elementSource.addEventListener(eventNameByConvention, (event) => callback.call(null, event.detail));
|
|
53
106
|
this._subscribedEvents.push({ name: eventNameByConvention, listener: callback });
|
|
107
|
+
// return a subscription that we can unsubscribe
|
|
108
|
+
return {
|
|
109
|
+
unsubscribe: () => this.unsubscribe(eventNameByConvention, callback)
|
|
110
|
+
};
|
|
54
111
|
}
|
|
55
112
|
/**
|
|
56
113
|
* Subscribes to a custom event message channel or message type.
|
|
@@ -63,60 +120,55 @@ class EventPubSubService {
|
|
|
63
120
|
const eventNameByConvention = this.getEventNameByNamingConvention(eventName, '');
|
|
64
121
|
this._elementSource.addEventListener(eventNameByConvention, listener);
|
|
65
122
|
this._subscribedEvents.push({ name: eventNameByConvention, listener });
|
|
123
|
+
// return a subscription that we can unsubscribe
|
|
124
|
+
return {
|
|
125
|
+
unsubscribe: () => this.unsubscribe(eventNameByConvention, listener)
|
|
126
|
+
};
|
|
66
127
|
}
|
|
67
128
|
/**
|
|
68
129
|
* Unsubscribes a message name
|
|
69
|
-
* @param event
|
|
130
|
+
* @param {String} event - the event name
|
|
131
|
+
* @param {*} listener - event listener callback
|
|
132
|
+
* @param {Boolean} shouldRemoveFromEventList - should we also remove the event from the subscriptions array?
|
|
70
133
|
* @return possibly a Subscription
|
|
71
134
|
*/
|
|
72
|
-
unsubscribe(eventName, listener) {
|
|
135
|
+
unsubscribe(eventName, listener, shouldRemoveFromEventList = true) {
|
|
73
136
|
const eventNameByConvention = this.getEventNameByNamingConvention(eventName, '');
|
|
74
137
|
this._elementSource.removeEventListener(eventNameByConvention, listener);
|
|
138
|
+
if (shouldRemoveFromEventList) {
|
|
139
|
+
this.removeSubscribedEventWhenFound(eventName, listener);
|
|
140
|
+
}
|
|
75
141
|
}
|
|
76
|
-
/** Unsubscribes all subscriptions that currently exists */
|
|
142
|
+
/** Unsubscribes all subscriptions/events that currently exists */
|
|
77
143
|
unsubscribeAll(subscriptions) {
|
|
78
144
|
if (Array.isArray(subscriptions)) {
|
|
79
|
-
|
|
145
|
+
let subscription;
|
|
146
|
+
do {
|
|
147
|
+
subscription = subscriptions.pop();
|
|
80
148
|
if (subscription === null || subscription === void 0 ? void 0 : subscription.dispose) {
|
|
81
149
|
subscription.dispose();
|
|
82
150
|
}
|
|
83
151
|
else if (subscription === null || subscription === void 0 ? void 0 : subscription.unsubscribe) {
|
|
84
152
|
subscription.unsubscribe();
|
|
85
153
|
}
|
|
86
|
-
}
|
|
154
|
+
} while (subscription);
|
|
87
155
|
}
|
|
88
156
|
else {
|
|
89
|
-
|
|
90
|
-
|
|
157
|
+
let pubSubEvent = this._subscribedEvents.pop();
|
|
158
|
+
while (pubSubEvent) {
|
|
159
|
+
this.unsubscribe(pubSubEvent.name, pubSubEvent.listener, false);
|
|
160
|
+
pubSubEvent = this._subscribedEvents.pop();
|
|
91
161
|
}
|
|
92
162
|
}
|
|
93
163
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
/** Get the event name by the convention defined, it could be: all lower case, camelCase, PascalCase or kebab-case */
|
|
103
|
-
getEventNameByNamingConvention(inputEventName, eventNamePrefix) {
|
|
104
|
-
let outputEventName = '';
|
|
105
|
-
switch (this.eventNamingStyle) {
|
|
106
|
-
case common_1.EventNamingStyle.camelCase:
|
|
107
|
-
outputEventName = (eventNamePrefix !== '') ? `${eventNamePrefix}${(0, common_1.titleCase)(inputEventName)}` : inputEventName;
|
|
108
|
-
break;
|
|
109
|
-
case common_1.EventNamingStyle.kebabCase:
|
|
110
|
-
outputEventName = (eventNamePrefix !== '') ? `${eventNamePrefix}-${(0, common_1.toKebabCase)(inputEventName)}` : (0, common_1.toKebabCase)(inputEventName);
|
|
111
|
-
break;
|
|
112
|
-
case common_1.EventNamingStyle.lowerCase:
|
|
113
|
-
outputEventName = `${eventNamePrefix}${inputEventName}`.toLowerCase();
|
|
114
|
-
break;
|
|
115
|
-
case common_1.EventNamingStyle.lowerCaseWithoutOnPrefix:
|
|
116
|
-
outputEventName = `${eventNamePrefix}${inputEventName.replace(/^on/, '')}`.toLowerCase();
|
|
117
|
-
break;
|
|
164
|
+
// --
|
|
165
|
+
// protected functions
|
|
166
|
+
// --------------------
|
|
167
|
+
removeSubscribedEventWhenFound(eventName, listener) {
|
|
168
|
+
const eventIdx = this._subscribedEvents.findIndex(evt => evt.name === eventName && evt.listener === listener);
|
|
169
|
+
if (eventIdx >= 0) {
|
|
170
|
+
this._subscribedEvents.splice(eventIdx, 1);
|
|
118
171
|
}
|
|
119
|
-
return outputEventName;
|
|
120
172
|
}
|
|
121
173
|
}
|
|
122
174
|
exports.EventPubSubService = EventPubSubService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventPubSub.service.js","sourceRoot":"","sources":["../../src/eventPubSub.service.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"eventPubSub.service.js","sourceRoot":"","sources":["../../src/eventPubSub.service.ts"],"names":[],"mappings":";;;AAAA,wDAAuI;AAOvI,MAAa,kBAAkB;IAsB7B,YAAY,aAAuB;QApBzB,sBAAiB,GAAkB,EAAE,CAAC;QAGhD,qBAAgB,GAAG,yBAAgB,CAAC,SAAS,CAAC;QAkB5C,2BAA2B;QAC3B,6GAA6G;QAC7G,IAAI,CAAC,cAAc,GAAG,aAAa,IAAI,QAAQ,C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QAAQ,EAAE,CAAC,CAAC,CAAC;SAC5C;IACH,CAAC;CACF;AAzLD,gDAyLC"}
|
|
@@ -1,15 +1,35 @@
|
|
|
1
|
-
import { EventNamingStyle, EventSubscription, PubSubService } from '@slickgrid-universal/common';
|
|
2
|
-
interface PubSubEvent {
|
|
1
|
+
import { EventNamingStyle, EventSubscription, PubSubService, Subscription } from '@slickgrid-universal/common';
|
|
2
|
+
export interface PubSubEvent<T = any> {
|
|
3
3
|
name: string;
|
|
4
|
-
listener: (event: CustomEventInit) => void;
|
|
4
|
+
listener: (event: T | CustomEventInit<T>) => void;
|
|
5
5
|
}
|
|
6
6
|
export declare class EventPubSubService implements PubSubService {
|
|
7
7
|
protected _elementSource: Element;
|
|
8
8
|
protected _subscribedEvents: PubSubEvent[];
|
|
9
|
+
protected _timer: any;
|
|
9
10
|
eventNamingStyle: EventNamingStyle;
|
|
11
|
+
get elementSource(): Element;
|
|
12
|
+
set elementSource(element: Element);
|
|
10
13
|
get subscribedEvents(): PubSubEvent[];
|
|
11
14
|
get subscribedEventNames(): string[];
|
|
12
15
|
constructor(elementSource?: Element);
|
|
16
|
+
dispose(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Dispatch of Custom Event, which by default will bubble up & is cancelable
|
|
19
|
+
* @param {String} eventName - event name to dispatch
|
|
20
|
+
* @param {*} data - optional data to include in the dispatching
|
|
21
|
+
* @param {Boolean} isBubbling - is the event bubbling up?
|
|
22
|
+
* @param {Boolean} isCancelable - is the event cancellable?
|
|
23
|
+
* @returns {Boolean} returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
|
|
24
|
+
*/
|
|
25
|
+
dispatchCustomEvent<T = any>(eventName: string, data?: T, isBubbling?: boolean, isCancelable?: boolean): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Get the event name by the convention defined, it could be: all lower case, camelCase, PascalCase or kebab-case
|
|
28
|
+
* @param {String} inputEventName - name of the event
|
|
29
|
+
* @param {String} eventNamePrefix - prefix to use in the event name
|
|
30
|
+
* @returns {String} - output event name
|
|
31
|
+
*/
|
|
32
|
+
getEventNameByNamingConvention(inputEventName: string, eventNamePrefix: string): string;
|
|
13
33
|
/**
|
|
14
34
|
* Method to publish a message via a dispatchEvent.
|
|
15
35
|
* Return is a Boolean (from the event dispatch) unless a delay is provided if so we'll return the dispatched event in a Promise with a delayed cycle
|
|
@@ -28,7 +48,7 @@ export declare class EventPubSubService implements PubSubService {
|
|
|
28
48
|
* @param callback The callback to be invoked when the specified message is published.
|
|
29
49
|
* @return possibly a Subscription
|
|
30
50
|
*/
|
|
31
|
-
subscribe<T = any>(eventName: string, callback: (data:
|
|
51
|
+
subscribe<T = any>(eventName: string, callback: (data: T) => void): Subscription;
|
|
32
52
|
/**
|
|
33
53
|
* Subscribes to a custom event message channel or message type.
|
|
34
54
|
* This is similar to the "subscribe" except that the callback receives an event typed as CustomEventInit and the data will be inside its "event.detail"
|
|
@@ -36,18 +56,16 @@ export declare class EventPubSubService implements PubSubService {
|
|
|
36
56
|
* @param callback The callback to be invoked when the specified message is published.
|
|
37
57
|
* @return possibly a Subscription
|
|
38
58
|
*/
|
|
39
|
-
subscribeEvent<T = any>(eventName: string, listener: (event: CustomEventInit<T>) => void):
|
|
59
|
+
subscribeEvent<T = any>(eventName: string, listener: (event: CustomEventInit<T>) => void): Subscription;
|
|
40
60
|
/**
|
|
41
61
|
* Unsubscribes a message name
|
|
42
|
-
* @param event
|
|
62
|
+
* @param {String} event - the event name
|
|
63
|
+
* @param {*} listener - event listener callback
|
|
64
|
+
* @param {Boolean} shouldRemoveFromEventList - should we also remove the event from the subscriptions array?
|
|
43
65
|
* @return possibly a Subscription
|
|
44
66
|
*/
|
|
45
|
-
unsubscribe(eventName: string, listener: (event: CustomEventInit) => void): void;
|
|
46
|
-
/** Unsubscribes all subscriptions that currently exists */
|
|
67
|
+
unsubscribe<T = any>(eventName: string, listener: (event: T | CustomEventInit<T>) => void, shouldRemoveFromEventList?: boolean): void;
|
|
68
|
+
/** Unsubscribes all subscriptions/events that currently exists */
|
|
47
69
|
unsubscribeAll(subscriptions?: EventSubscription[]): void;
|
|
48
|
-
|
|
49
|
-
dispatchCustomEvent<T = any>(eventName: string, data?: T, isBubbling?: boolean, isCancelable?: boolean): boolean;
|
|
50
|
-
/** Get the event name by the convention defined, it could be: all lower case, camelCase, PascalCase or kebab-case */
|
|
51
|
-
getEventNameByNamingConvention(inputEventName: string, eventNamePrefix: string): string;
|
|
70
|
+
protected removeSubscribedEventWhenFound<T>(eventName: string, listener: (event: T | CustomEventInit<T>) => void): void;
|
|
52
71
|
}
|
|
53
|
-
export {};
|
|
@@ -7,12 +7,66 @@ export class EventPubSubService {
|
|
|
7
7
|
// or create a "phantom DOM node" (a div element that is never rendered) to set up a custom event dispatching
|
|
8
8
|
this._elementSource = elementSource || document.createElement('div');
|
|
9
9
|
}
|
|
10
|
+
get elementSource() {
|
|
11
|
+
return this._elementSource;
|
|
12
|
+
}
|
|
13
|
+
set elementSource(element) {
|
|
14
|
+
this._elementSource = element;
|
|
15
|
+
}
|
|
10
16
|
get subscribedEvents() {
|
|
11
17
|
return this._subscribedEvents;
|
|
12
18
|
}
|
|
13
19
|
get subscribedEventNames() {
|
|
14
20
|
return this._subscribedEvents.map((pubSubEvent) => pubSubEvent.name);
|
|
15
21
|
}
|
|
22
|
+
dispose() {
|
|
23
|
+
var _a;
|
|
24
|
+
this.unsubscribeAll();
|
|
25
|
+
this._subscribedEvents = [];
|
|
26
|
+
clearTimeout(this._timer);
|
|
27
|
+
(_a = this._elementSource) === null || _a === void 0 ? void 0 : _a.remove();
|
|
28
|
+
this._elementSource = null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Dispatch of Custom Event, which by default will bubble up & is cancelable
|
|
32
|
+
* @param {String} eventName - event name to dispatch
|
|
33
|
+
* @param {*} data - optional data to include in the dispatching
|
|
34
|
+
* @param {Boolean} isBubbling - is the event bubbling up?
|
|
35
|
+
* @param {Boolean} isCancelable - is the event cancellable?
|
|
36
|
+
* @returns {Boolean} returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
|
|
37
|
+
*/
|
|
38
|
+
dispatchCustomEvent(eventName, data, isBubbling = true, isCancelable = true) {
|
|
39
|
+
var _a;
|
|
40
|
+
const eventInit = { bubbles: isBubbling, cancelable: isCancelable };
|
|
41
|
+
if (data) {
|
|
42
|
+
eventInit.detail = data;
|
|
43
|
+
}
|
|
44
|
+
return (_a = this._elementSource) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new CustomEvent(eventName, eventInit));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get the event name by the convention defined, it could be: all lower case, camelCase, PascalCase or kebab-case
|
|
48
|
+
* @param {String} inputEventName - name of the event
|
|
49
|
+
* @param {String} eventNamePrefix - prefix to use in the event name
|
|
50
|
+
* @returns {String} - output event name
|
|
51
|
+
*/
|
|
52
|
+
getEventNameByNamingConvention(inputEventName, eventNamePrefix) {
|
|
53
|
+
let outputEventName = '';
|
|
54
|
+
switch (this.eventNamingStyle) {
|
|
55
|
+
case EventNamingStyle.camelCase:
|
|
56
|
+
outputEventName = (eventNamePrefix !== '') ? `${eventNamePrefix}${titleCase(inputEventName)}` : inputEventName;
|
|
57
|
+
break;
|
|
58
|
+
case EventNamingStyle.kebabCase:
|
|
59
|
+
outputEventName = (eventNamePrefix !== '') ? `${eventNamePrefix}-${toKebabCase(inputEventName)}` : toKebabCase(inputEventName);
|
|
60
|
+
break;
|
|
61
|
+
case EventNamingStyle.lowerCase:
|
|
62
|
+
outputEventName = `${eventNamePrefix}${inputEventName}`.toLowerCase();
|
|
63
|
+
break;
|
|
64
|
+
case EventNamingStyle.lowerCaseWithoutOnPrefix:
|
|
65
|
+
outputEventName = `${eventNamePrefix}${inputEventName.replace(/^on/, '')}`.toLowerCase();
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
return outputEventName;
|
|
69
|
+
}
|
|
16
70
|
/**
|
|
17
71
|
* Method to publish a message via a dispatchEvent.
|
|
18
72
|
* Return is a Boolean (from the event dispatch) unless a delay is provided if so we'll return the dispatched event in a Promise with a delayed cycle
|
|
@@ -28,8 +82,7 @@ export class EventPubSubService {
|
|
|
28
82
|
const eventNameByConvention = this.getEventNameByNamingConvention(eventName, '');
|
|
29
83
|
if (delay) {
|
|
30
84
|
return new Promise(resolve => {
|
|
31
|
-
|
|
32
|
-
setTimeout(() => resolve(isDispatched), delay);
|
|
85
|
+
this._timer = setTimeout(() => resolve(this.dispatchCustomEvent(eventNameByConvention, data, true, true)), delay);
|
|
33
86
|
});
|
|
34
87
|
}
|
|
35
88
|
else {
|
|
@@ -48,6 +101,10 @@ export class EventPubSubService {
|
|
|
48
101
|
// basically we substitute the "data" with "event.detail" so that the user ends up with only the "data" result
|
|
49
102
|
this._elementSource.addEventListener(eventNameByConvention, (event) => callback.call(null, event.detail));
|
|
50
103
|
this._subscribedEvents.push({ name: eventNameByConvention, listener: callback });
|
|
104
|
+
// return a subscription that we can unsubscribe
|
|
105
|
+
return {
|
|
106
|
+
unsubscribe: () => this.unsubscribe(eventNameByConvention, callback)
|
|
107
|
+
};
|
|
51
108
|
}
|
|
52
109
|
/**
|
|
53
110
|
* Subscribes to a custom event message channel or message type.
|
|
@@ -60,60 +117,55 @@ export class EventPubSubService {
|
|
|
60
117
|
const eventNameByConvention = this.getEventNameByNamingConvention(eventName, '');
|
|
61
118
|
this._elementSource.addEventListener(eventNameByConvention, listener);
|
|
62
119
|
this._subscribedEvents.push({ name: eventNameByConvention, listener });
|
|
120
|
+
// return a subscription that we can unsubscribe
|
|
121
|
+
return {
|
|
122
|
+
unsubscribe: () => this.unsubscribe(eventNameByConvention, listener)
|
|
123
|
+
};
|
|
63
124
|
}
|
|
64
125
|
/**
|
|
65
126
|
* Unsubscribes a message name
|
|
66
|
-
* @param event
|
|
127
|
+
* @param {String} event - the event name
|
|
128
|
+
* @param {*} listener - event listener callback
|
|
129
|
+
* @param {Boolean} shouldRemoveFromEventList - should we also remove the event from the subscriptions array?
|
|
67
130
|
* @return possibly a Subscription
|
|
68
131
|
*/
|
|
69
|
-
unsubscribe(eventName, listener) {
|
|
132
|
+
unsubscribe(eventName, listener, shouldRemoveFromEventList = true) {
|
|
70
133
|
const eventNameByConvention = this.getEventNameByNamingConvention(eventName, '');
|
|
71
134
|
this._elementSource.removeEventListener(eventNameByConvention, listener);
|
|
135
|
+
if (shouldRemoveFromEventList) {
|
|
136
|
+
this.removeSubscribedEventWhenFound(eventName, listener);
|
|
137
|
+
}
|
|
72
138
|
}
|
|
73
|
-
/** Unsubscribes all subscriptions that currently exists */
|
|
139
|
+
/** Unsubscribes all subscriptions/events that currently exists */
|
|
74
140
|
unsubscribeAll(subscriptions) {
|
|
75
141
|
if (Array.isArray(subscriptions)) {
|
|
76
|
-
|
|
142
|
+
let subscription;
|
|
143
|
+
do {
|
|
144
|
+
subscription = subscriptions.pop();
|
|
77
145
|
if (subscription === null || subscription === void 0 ? void 0 : subscription.dispose) {
|
|
78
146
|
subscription.dispose();
|
|
79
147
|
}
|
|
80
148
|
else if (subscription === null || subscription === void 0 ? void 0 : subscription.unsubscribe) {
|
|
81
149
|
subscription.unsubscribe();
|
|
82
150
|
}
|
|
83
|
-
}
|
|
151
|
+
} while (subscription);
|
|
84
152
|
}
|
|
85
153
|
else {
|
|
86
|
-
|
|
87
|
-
|
|
154
|
+
let pubSubEvent = this._subscribedEvents.pop();
|
|
155
|
+
while (pubSubEvent) {
|
|
156
|
+
this.unsubscribe(pubSubEvent.name, pubSubEvent.listener, false);
|
|
157
|
+
pubSubEvent = this._subscribedEvents.pop();
|
|
88
158
|
}
|
|
89
159
|
}
|
|
90
160
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
/** Get the event name by the convention defined, it could be: all lower case, camelCase, PascalCase or kebab-case */
|
|
100
|
-
getEventNameByNamingConvention(inputEventName, eventNamePrefix) {
|
|
101
|
-
let outputEventName = '';
|
|
102
|
-
switch (this.eventNamingStyle) {
|
|
103
|
-
case EventNamingStyle.camelCase:
|
|
104
|
-
outputEventName = (eventNamePrefix !== '') ? `${eventNamePrefix}${titleCase(inputEventName)}` : inputEventName;
|
|
105
|
-
break;
|
|
106
|
-
case EventNamingStyle.kebabCase:
|
|
107
|
-
outputEventName = (eventNamePrefix !== '') ? `${eventNamePrefix}-${toKebabCase(inputEventName)}` : toKebabCase(inputEventName);
|
|
108
|
-
break;
|
|
109
|
-
case EventNamingStyle.lowerCase:
|
|
110
|
-
outputEventName = `${eventNamePrefix}${inputEventName}`.toLowerCase();
|
|
111
|
-
break;
|
|
112
|
-
case EventNamingStyle.lowerCaseWithoutOnPrefix:
|
|
113
|
-
outputEventName = `${eventNamePrefix}${inputEventName.replace(/^on/, '')}`.toLowerCase();
|
|
114
|
-
break;
|
|
161
|
+
// --
|
|
162
|
+
// protected functions
|
|
163
|
+
// --------------------
|
|
164
|
+
removeSubscribedEventWhenFound(eventName, listener) {
|
|
165
|
+
const eventIdx = this._subscribedEvents.findIndex(evt => evt.name === eventName && evt.listener === listener);
|
|
166
|
+
if (eventIdx >= 0) {
|
|
167
|
+
this._subscribedEvents.splice(eventIdx, 1);
|
|
115
168
|
}
|
|
116
|
-
return outputEventName;
|
|
117
169
|
}
|
|
118
170
|
}
|
|
119
171
|
//# sourceMappingURL=eventPubSub.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventPubSub.service.js","sourceRoot":"","sources":["../../src/eventPubSub.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"eventPubSub.service.js","sourceRoot":"","sources":["../../src/eventPubSub.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAkD,SAAS,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAOvI,MAAM,OAAO,kBAAkB;IA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,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;QAC9G,IAAI,QAAQ,IAAI,CAAC,EAAE;YACjB,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;SAC5C;IACH,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slickgrid-universal/event-pub-sub",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Simple Vanilla Implementation of an Event PubSub Service to do simply publish/subscribe inter-communication while optionally providing data in the event",
|
|
5
5
|
"main": "dist/commonjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"not dead"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@slickgrid-universal/common": "^
|
|
50
|
+
"@slickgrid-universal/common": "^1.2.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"cross-env": "^7.0.3",
|
|
54
54
|
"npm-run-all": "^4.1.5",
|
|
55
55
|
"rimraf": "^3.0.2"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "11a05e9877ac0a42d53eaefb1edf95586dcd41b3"
|
|
58
58
|
}
|