@slickgrid-universal/event-pub-sub 1.1.1 → 1.2.4

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2020-2021, Ghislain B. - Slickgrid-Universal
1
+ Copyright (c) 2020-2022, Ghislain B. - Slickgrid-Universal
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -1,22 +1,22 @@
1
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
2
- [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)
3
- [![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)
4
- [![npm](https://img.shields.io/npm/v/@slickgrid-universal/event-pub-sub.svg?color=forest)](https://www.npmjs.com/package/@slickgrid-universal/event-pub-sub)
5
- [![npm](https://img.shields.io/npm/dy/@slickgrid-universal/event-pub-sub?color=forest)](https://www.npmjs.com/package/@slickgrid-universal/event-pub-sub)
6
-
7
- [![Actions Status](https://github.com/ghiscoding/slickgrid-universal/workflows/CI%20Build/badge.svg)](https://github.com/ghiscoding/slickgrid-universal/actions)
8
- [![Cypress.io](https://img.shields.io/badge/tested%20with-Cypress-04C38E.svg)](https://www.cypress.io/)
9
- [![jest](https://jestjs.io/img/jest-badge.svg)](https://github.com/facebook/jest)
10
- [![codecov](https://codecov.io/gh/ghiscoding/slickgrid-universal/branch/master/graph/badge.svg)](https://codecov.io/gh/ghiscoding/slickgrid-universal)
11
-
12
- ## Event PubSub Service
13
- #### @slickgrid-universal/event-pub-sub
14
-
15
- A very simple Vanilla Implementation of an Event PubSub Service to do simple publish/subscribe inter-communication while optionally providing data as well.
16
-
17
- ### Internal Dependencies
18
- - [@slickgrid-universal/common](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/common)
19
-
20
-
21
- ### Installation
22
- Follow the instruction provided in the main [README](https://github.com/ghiscoding/slickgrid-universal#installation)
1
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
2
+ [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)
3
+ [![lerna--lite](https://img.shields.io/badge/maintained%20with-lerna--lite-blueviolet)](https://github.com/ghiscoding/lerna-lite)
4
+ [![npm](https://img.shields.io/npm/v/@slickgrid-universal/event-pub-sub.svg?color=forest)](https://www.npmjs.com/package/@slickgrid-universal/event-pub-sub)
5
+ [![npm](https://img.shields.io/npm/dy/@slickgrid-universal/event-pub-sub?color=forest)](https://www.npmjs.com/package/@slickgrid-universal/event-pub-sub)
6
+
7
+ [![Actions Status](https://github.com/ghiscoding/slickgrid-universal/workflows/CI%20Build/badge.svg)](https://github.com/ghiscoding/slickgrid-universal/actions)
8
+ [![Cypress.io](https://img.shields.io/badge/tested%20with-Cypress-04C38E.svg)](https://www.cypress.io/)
9
+ [![jest](https://jestjs.io/img/jest-badge.svg)](https://github.com/facebook/jest)
10
+ [![codecov](https://codecov.io/gh/ghiscoding/slickgrid-universal/branch/master/graph/badge.svg)](https://codecov.io/gh/ghiscoding/slickgrid-universal)
11
+
12
+ ## Event PubSub Service
13
+ #### @slickgrid-universal/event-pub-sub
14
+
15
+ A very simple Vanilla Implementation of an Event PubSub Service to do simple publish/subscribe inter-communication while optionally providing data as well.
16
+
17
+ ### Internal Dependencies
18
+ - [@slickgrid-universal/common](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/common)
19
+
20
+
21
+ ### Installation
22
+ Follow the instruction provided in the main [README](https://github.com/ghiscoding/slickgrid-universal#installation)
@@ -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: any) => void): any;
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): any | void;
59
+ subscribeEvent<T = any>(eventName: string, listener: (event: CustomEventInit<T>) => void): Subscription;
40
60
  /**
41
61
  * Unsubscribes a message name
42
- * @param event The event name
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
- /** Dispatch of Custom Event, which by default will bubble up & is cancelable */
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
- const isDispatched = this.dispatchCustomEvent(eventNameByConvention, data, true, true);
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 The event name
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
- for (const subscription of subscriptions) {
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
- for (const pubSubEvent of this._subscribedEvents) {
90
- this.unsubscribe(pubSubEvent.name, pubSubEvent.listener);
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
- /** Dispatch of Custom Event, which by default will bubble up & is cancelable */
95
- dispatchCustomEvent(eventName, data, isBubbling = true, isCancelable = true) {
96
- const eventInit = { bubbles: isBubbling, cancelable: isCancelable };
97
- if (data) {
98
- eventInit.detail = data;
99
- }
100
- return this._elementSource.dispatchEvent(new CustomEvent(eventName, eventInit));
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,wDAAyH;AAOzH,MAAa,kBAAkB;IAc7B,YAAY,aAAuB;QAZzB,sBAAiB,GAAkB,EAAE,CAAC;QAEhD,qBAAgB,GAAG,yBAAgB,CAAC,SAAS,CAAC;QAW5C,2BAA2B;QAC3B,6GAA6G;QAC7G,IAAI,CAAC,cAAc,GAAG,aAAa,IAAI,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACvE,CAAC;IAZD,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IAED,IAAI,oBAAoB;QACtB,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACvE,CAAC;IAQD;;;;;;;;;;OAUG;IACH,OAAO,CAAU,S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;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: any) => void): any;
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): any | void;
59
+ subscribeEvent<T = any>(eventName: string, listener: (event: CustomEventInit<T>) => void): Subscription;
40
60
  /**
41
61
  * Unsubscribes a message name
42
- * @param event The event name
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
- /** Dispatch of Custom Event, which by default will bubble up & is cancelable */
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
- const isDispatched = this.dispatchCustomEvent(eventNameByConvention, data, true, true);
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 The event name
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
- for (const subscription of subscriptions) {
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
- for (const pubSubEvent of this._subscribedEvents) {
87
- this.unsubscribe(pubSubEvent.name, pubSubEvent.listener);
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
- /** Dispatch of Custom Event, which by default will bubble up & is cancelable */
92
- dispatchCustomEvent(eventName, data, isBubbling = true, isCancelable = true) {
93
- const eventInit = { bubbles: isBubbling, cancelable: isCancelable };
94
- if (data) {
95
- eventInit.detail = data;
96
- }
97
- return this._elementSource.dispatchEvent(new CustomEvent(eventName, eventInit));
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,EAAoC,SAAS,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAOzH,MAAM,OAAO,kBAAkB;IAc7B,YAAY,aAAuB;QAZzB,sBAAiB,GAAkB,EAAE,CAAC;QAEhD,qBAAgB,GAAG,gBAAgB,CAAC,SAAS,CAAC;QAW5C,2BAA2B;QAC3B,6GAA6G;QAC7G,IAAI,CAAC,cAAc,GAAG,aAAa,IAAI,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACvE,CAAC;IAZD,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IAED,IAAI,oBAAoB;QACtB,OAAO,IAAI,CAA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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": "1.1.1",
3
+ "version": "1.2.4",
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",
@@ -14,14 +14,14 @@
14
14
  ],
15
15
  "scripts": {
16
16
  "build": "cross-env tsc --build",
17
- "postbuild": "npm-run-all bundle:commonjs",
17
+ "postbuild": "npm-run-all bundle:commonjs --npm-path npm",
18
18
  "build:watch": "cross-env tsc --incremental --watch",
19
- "dev": "run-s build",
20
- "dev:watch": "run-p build:watch",
21
- "bundle": "run-p bundle:commonjs bundle:esm",
19
+ "dev": "npm run build",
20
+ "dev:watch": "run-p build:watch --npm-path npm",
21
+ "bundle": "run-p bundle:commonjs bundle:esm --npm-path npm",
22
22
  "bundle:commonjs": "tsc --project tsconfig.bundle.json --outDir dist/commonjs --module commonjs",
23
23
  "bundle:esm": "cross-env tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018",
24
- "prebundle": "npm-run-all delete:dist",
24
+ "prebundle": "npm-run-all delete:dist --npm-path npm",
25
25
  "delete:dist": "cross-env rimraf --maxBusyTries=10 dist",
26
26
  "package:add-browser-prop": "cross-env node ../change-package-browser.js --add-browser=true --folder-name=event-pub-sub",
27
27
  "package:remove-browser-prop": "cross-env node ../change-package-browser.js --remove-browser=true --folder-name=event-pub-sub"
@@ -47,12 +47,12 @@
47
47
  "not dead"
48
48
  ],
49
49
  "dependencies": {
50
- "@slickgrid-universal/common": "^1.1.0"
50
+ "@slickgrid-universal/common": "^1.2.4"
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": "c73565b875e9df7a4b26613bd0307d75156ef2d1"
57
+ "gitHead": "8e431aba7e359bb1cd28d7c96890ba90db9588ee"
58
58
  }
package/CHANGELOG.md DELETED
@@ -1,111 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [1.1.1](https://github.com/ghiscoding/slickgrid-universal/compare/v1.1.0...v1.1.1) (2021-12-11)
7
-
8
-
9
- ### Bug Fixes
10
-
11
- * **build:** bump version manually bcoz of previous force push ([5e9a610](https://github.com/ghiscoding/slickgrid-universal/commit/5e9a610ad01d752673856591f9b5de73b0ece0e9))
12
-
13
-
14
-
15
-
16
-
17
- # [1.1.0](https://github.com/ghiscoding/slickgrid-universal/compare/v0.19.2...v1.1.0) (2021-12-11)
18
-
19
- **Note:** Version bump only for package @slickgrid-universal/event-pub-sub
20
-
21
-
22
-
23
-
24
-
25
-
26
- ## [0.19.2](https://github.com/ghiscoding/slickgrid-universal/compare/v0.19.1...v0.19.2) (2021-11-19)
27
-
28
- **Note:** Version bump only for package @slickgrid-universal/event-pub-sub
29
-
30
-
31
-
32
-
33
-
34
-
35
- ## [0.19.1](https://github.com/ghiscoding/slickgrid-universal/compare/v0.19.0...v0.19.1) (2021-11-15)
36
-
37
- **Note:** Version bump only for package @slickgrid-universal/event-pub-sub
38
-
39
-
40
-
41
-
42
-
43
-
44
- # [0.19.0](https://github.com/ghiscoding/slickgrid-universal/compare/v0.18.0...v0.19.0) (2021-10-28)
45
-
46
- **Note:** Version bump only for package @slickgrid-universal/event-pub-sub
47
-
48
-
49
-
50
-
51
-
52
-
53
- # [0.18.0](https://github.com/ghiscoding/slickgrid-universal/compare/v0.17.0...v0.18.0) (2021-09-29)
54
-
55
- **Note:** Version bump only for package @slickgrid-universal/event-pub-sub
56
-
57
-
58
-
59
-
60
-
61
-
62
- # [0.17.0](https://github.com/ghiscoding/slickgrid-universal/compare/v0.16.2...v0.17.0) (2021-09-09)
63
-
64
-
65
- ### Features
66
-
67
- * **backend:** add cancellable onBeforeSearchChange & revert on error ([b26a53d](https://github.com/ghiscoding/slickgrid-universal/commit/b26a53d2e1fc7172c8c054b9c27ab1b3a2d3dff6))
68
-
69
-
70
-
71
-
72
-
73
- ## [0.16.2](https://github.com/ghiscoding/slickgrid-universal/compare/v0.16.1...v0.16.2) (2021-07-23)
74
-
75
- **Note:** Version bump only for package @slickgrid-universal/event-pub-sub
76
-
77
-
78
-
79
-
80
-
81
- ## [0.16.1](https://github.com/ghiscoding/slickgrid-universal/compare/v0.16.0...v0.16.1) (2021-07-16)
82
-
83
- **Note:** Version bump only for package @slickgrid-universal/event-pub-sub
84
-
85
-
86
-
87
-
88
-
89
- # [0.16.0](https://github.com/ghiscoding/slickgrid-universal/compare/v0.15.0...v0.16.0) (2021-07-16)
90
-
91
-
92
- ### Features
93
-
94
- * **services:** make everything extendable by using `protected` ([ecbb93a](https://github.com/ghiscoding/slickgrid-universal/commit/ecbb93a56abba39dd050bbd6019b86694495edd1))
95
-
96
-
97
-
98
-
99
-
100
- # [0.15.0](https://github.com/ghiscoding/slickgrid-universal/compare/v0.14.1...v0.15.0) (2021-07-06)
101
-
102
-
103
- ### Bug Fixes
104
-
105
- * **build:** the "files" property should be included in pkg.json ([3d8f12e](https://github.com/ghiscoding/slickgrid-universal/commit/3d8f12e5f55079445c6fb5cde767f8e0b4511ebb))
106
-
107
-
108
- ### Features
109
-
110
- * **services:** decouple the EventPubSubService to separate package ([9f51665](https://github.com/ghiscoding/slickgrid-universal/commit/9f516655e9ce5f06e0cfeabc43536834dc38c70b))
111
- * **services:** move Resizer Service w/common services folder for reuse ([d127ac7](https://github.com/ghiscoding/slickgrid-universal/commit/d127ac797ee787ea7785e8ae9f4c0bcaed786afd))