@slickgrid-universal/event-pub-sub 1.2.4 → 1.3.0
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 +20 -20
- package/README.md +22 -22
- package/dist/commonjs/basePubSub.service.d.ts +32 -0
- package/dist/commonjs/basePubSub.service.js +48 -0
- package/dist/commonjs/basePubSub.service.js.map +1 -0
- package/dist/commonjs/eventPubSub.service.d.ts +3 -2
- package/dist/commonjs/eventPubSub.service.js +9 -8
- package/dist/commonjs/eventPubSub.service.js.map +1 -1
- package/dist/commonjs/index.d.ts +2 -0
- package/dist/commonjs/index.js +7 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/types/eventNamingStyle.enum.d.ts +10 -0
- package/dist/commonjs/types/eventNamingStyle.enum.js +15 -0
- package/dist/commonjs/types/eventNamingStyle.enum.js.map +1 -0
- package/dist/commonjs/types/eventSubscription.interface.d.ts +10 -0
- package/dist/commonjs/types/eventSubscription.interface.js +3 -0
- package/dist/commonjs/types/eventSubscription.interface.js.map +1 -0
- package/dist/commonjs/types/index.d.ts +2 -0
- package/dist/commonjs/types/index.js +19 -0
- package/dist/commonjs/types/index.js.map +1 -0
- package/dist/esm/basePubSub.service.d.ts +32 -0
- package/dist/esm/basePubSub.service.js +44 -0
- package/dist/esm/basePubSub.service.js.map +1 -0
- package/dist/esm/eventPubSub.service.d.ts +3 -2
- package/dist/esm/eventPubSub.service.js +2 -1
- package/dist/esm/eventPubSub.service.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/eventNamingStyle.enum.d.ts +10 -0
- package/dist/esm/types/eventNamingStyle.enum.js +12 -0
- package/dist/esm/types/eventNamingStyle.enum.js.map +1 -0
- package/dist/esm/types/eventSubscription.interface.d.ts +10 -0
- package/dist/esm/types/eventSubscription.interface.js +2 -0
- package/dist/esm/types/eventSubscription.interface.js.map +1 -0
- package/dist/esm/types/index.d.ts +2 -0
- package/dist/esm/types/index.js +3 -0
- package/dist/esm/types/index.js.map +1 -0
- package/package.json +9 -17
package/LICENSE
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
Copyright (c) 2020-2022, Ghislain B. - Slickgrid-Universal
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
-
a copy of this software and associated documentation files (the
|
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
-
the following conditions:
|
|
10
|
-
|
|
11
|
-
The above copyright notice and this permission notice shall be
|
|
12
|
-
included in all copies or substantial portions of the Software.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
Copyright (c) 2020-2022, Ghislain B. - Slickgrid-Universal
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
[](https://opensource.org/licenses/MIT)
|
|
2
|
-
[](http://www.typescriptlang.org/)
|
|
3
|
-
[](https://www.npmjs.com/package/@slickgrid-universal/event-pub-sub)
|
|
5
|
-
[](https://www.npmjs.com/package/@slickgrid-universal/event-pub-sub)
|
|
6
|
-
|
|
7
|
-
[](https://github.com/ghiscoding/slickgrid-universal/actions)
|
|
8
|
-
[](https://www.cypress.io/)
|
|
9
|
-
[](https://github.com/facebook/jest)
|
|
10
|
-
[](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/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
### Installation
|
|
22
|
-
Follow the instruction provided in the main [README](https://github.com/ghiscoding/slickgrid-universal#installation)
|
|
1
|
+
[](https://opensource.org/licenses/MIT)
|
|
2
|
+
[](http://www.typescriptlang.org/)
|
|
3
|
+
[](https://github.com/ghiscoding/lerna-lite)
|
|
4
|
+
[](https://www.npmjs.com/package/@slickgrid-universal/event-pub-sub)
|
|
5
|
+
[](https://www.npmjs.com/package/@slickgrid-universal/event-pub-sub)
|
|
6
|
+
|
|
7
|
+
[](https://github.com/ghiscoding/slickgrid-universal/actions)
|
|
8
|
+
[](https://www.cypress.io/)
|
|
9
|
+
[](https://github.com/facebook/jest)
|
|
10
|
+
[](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/utils](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/utils)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Installation
|
|
22
|
+
Follow the instruction provided in the main [README](https://github.com/ghiscoding/slickgrid-universal#installation)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { EventSubscription } from './types';
|
|
2
|
+
export declare abstract class BasePubSubService {
|
|
3
|
+
/**
|
|
4
|
+
* Method to publish a message
|
|
5
|
+
* @param event The event or channel to publish to.
|
|
6
|
+
* @param data The data to publish on the channel.
|
|
7
|
+
*/
|
|
8
|
+
publish<T = any>(_eventName: string | any, _data?: T, _delay?: number): void | boolean | Promise<boolean>;
|
|
9
|
+
/**
|
|
10
|
+
* Subscribes to a message channel or message type.
|
|
11
|
+
* @param event The event channel or event data type.
|
|
12
|
+
* @param callback The callback to be invoked when the specified message is published.
|
|
13
|
+
* @return possibly a Subscription
|
|
14
|
+
*/
|
|
15
|
+
subscribe<T = any>(_eventName: string | Function, _callback: (data: T) => void): EventSubscription | any;
|
|
16
|
+
/**
|
|
17
|
+
* Subscribes to a custom event message channel or message type.
|
|
18
|
+
* 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"
|
|
19
|
+
* @param event The event channel or event data type.
|
|
20
|
+
* @param callback The callback to be invoked when the specified message is published.
|
|
21
|
+
* @return possibly a Subscription
|
|
22
|
+
*/
|
|
23
|
+
subscribeEvent?<T = any>(_eventName: string | Function, _callback: (event: CustomEventInit<T>) => void): EventSubscription | any;
|
|
24
|
+
/**
|
|
25
|
+
* Unsubscribes a message name
|
|
26
|
+
* @param event The event name
|
|
27
|
+
* @return possibly a Subscription
|
|
28
|
+
*/
|
|
29
|
+
unsubscribe(_eventName: string, _callback: (event: CustomEventInit) => void): void;
|
|
30
|
+
/** Unsubscribes all subscriptions that currently exists */
|
|
31
|
+
unsubscribeAll(_subscriptions?: EventSubscription[]): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BasePubSubService = void 0;
|
|
4
|
+
class BasePubSubService {
|
|
5
|
+
/**
|
|
6
|
+
* Method to publish a message
|
|
7
|
+
* @param event The event or channel to publish to.
|
|
8
|
+
* @param data The data to publish on the channel.
|
|
9
|
+
*/
|
|
10
|
+
publish(_eventName, _data, _delay) {
|
|
11
|
+
throw new Error('BasePubSubService "publish" method must be implemented');
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Subscribes to a message channel or message type.
|
|
15
|
+
* @param event The event channel or event data type.
|
|
16
|
+
* @param callback The callback to be invoked when the specified message is published.
|
|
17
|
+
* @return possibly a Subscription
|
|
18
|
+
*/
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
20
|
+
subscribe(_eventName, _callback) {
|
|
21
|
+
throw new Error('BasePubSubService "subscribe" method must be implemented');
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Subscribes to a custom event message channel or message type.
|
|
25
|
+
* 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"
|
|
26
|
+
* @param event The event channel or event data type.
|
|
27
|
+
* @param callback The callback to be invoked when the specified message is published.
|
|
28
|
+
* @return possibly a Subscription
|
|
29
|
+
*/
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
31
|
+
subscribeEvent(_eventName, _callback) {
|
|
32
|
+
throw new Error('BasePubSubService "subscribeEvent" method must be implemented');
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Unsubscribes a message name
|
|
36
|
+
* @param event The event name
|
|
37
|
+
* @return possibly a Subscription
|
|
38
|
+
*/
|
|
39
|
+
unsubscribe(_eventName, _callback) {
|
|
40
|
+
throw new Error('BasePubSubService "unsubscribe" method must be implemented');
|
|
41
|
+
}
|
|
42
|
+
/** Unsubscribes all subscriptions that currently exists */
|
|
43
|
+
unsubscribeAll(_subscriptions) {
|
|
44
|
+
throw new Error('BasePubSubService "unsubscribeAll" method must be implemented');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.BasePubSubService = BasePubSubService;
|
|
48
|
+
//# sourceMappingURL=basePubSub.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basePubSub.service.js","sourceRoot":"","sources":["../../src/basePubSub.service.ts"],"names":[],"mappings":";;;AAGA,MAAsB,iBAAiB;IACrC;;;;OAIG;IACH,OAAO,CAAU,UAAwB,EAAE,KAAS,EAAE,MAAe;QACnE,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;QAKI;IACJ,wDAAwD;IACxD,SAAS,CAAU,UAA6B,EAAE,SAA4B;QAC5E,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;IAED;;;;;;QAMI;IACJ,wDAAwD;IACxD,cAAc,CAAW,UAA6B,EAAE,SAA8C;QACpG,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACnF,CAAC;IAED;;;;QAII;IACJ,WAAW,CAAC,UAAkB,EAAE,SAA2C;QACzE,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAChF,CAAC;IAED,2DAA2D;IAC3D,cAAc,CAAC,cAAoC;QACjD,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACnF,CAAC;CACF;AA9CD,8CA8CC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BasePubSubService } from './basePubSub.service';
|
|
2
|
+
import { EventNamingStyle, EventSubscription, Subscription } from './types';
|
|
2
3
|
export interface PubSubEvent<T = any> {
|
|
3
4
|
name: string;
|
|
4
5
|
listener: (event: T | CustomEventInit<T>) => void;
|
|
5
6
|
}
|
|
6
|
-
export declare class EventPubSubService implements
|
|
7
|
+
export declare class EventPubSubService implements BasePubSubService {
|
|
7
8
|
protected _elementSource: Element;
|
|
8
9
|
protected _subscribedEvents: PubSubEvent[];
|
|
9
10
|
protected _timer: any;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EventPubSubService = void 0;
|
|
4
|
-
const
|
|
4
|
+
const utils_1 = require("@slickgrid-universal/utils");
|
|
5
|
+
const types_1 = require("./types");
|
|
5
6
|
class EventPubSubService {
|
|
6
7
|
constructor(elementSource) {
|
|
7
8
|
this._subscribedEvents = [];
|
|
8
|
-
this.eventNamingStyle =
|
|
9
|
+
this.eventNamingStyle = types_1.EventNamingStyle.camelCase;
|
|
9
10
|
// use the provided element
|
|
10
11
|
// or create a "phantom DOM node" (a div element that is never rendered) to set up a custom event dispatching
|
|
11
12
|
this._elementSource = elementSource || document.createElement('div');
|
|
@@ -55,16 +56,16 @@ class EventPubSubService {
|
|
|
55
56
|
getEventNameByNamingConvention(inputEventName, eventNamePrefix) {
|
|
56
57
|
let outputEventName = '';
|
|
57
58
|
switch (this.eventNamingStyle) {
|
|
58
|
-
case
|
|
59
|
-
outputEventName = (eventNamePrefix !== '') ? `${eventNamePrefix}${(0,
|
|
59
|
+
case types_1.EventNamingStyle.camelCase:
|
|
60
|
+
outputEventName = (eventNamePrefix !== '') ? `${eventNamePrefix}${(0, utils_1.titleCase)(inputEventName)}` : inputEventName;
|
|
60
61
|
break;
|
|
61
|
-
case
|
|
62
|
-
outputEventName = (eventNamePrefix !== '') ? `${eventNamePrefix}-${(0,
|
|
62
|
+
case types_1.EventNamingStyle.kebabCase:
|
|
63
|
+
outputEventName = (eventNamePrefix !== '') ? `${eventNamePrefix}-${(0, utils_1.toKebabCase)(inputEventName)}` : (0, utils_1.toKebabCase)(inputEventName);
|
|
63
64
|
break;
|
|
64
|
-
case
|
|
65
|
+
case types_1.EventNamingStyle.lowerCase:
|
|
65
66
|
outputEventName = `${eventNamePrefix}${inputEventName}`.toLowerCase();
|
|
66
67
|
break;
|
|
67
|
-
case
|
|
68
|
+
case types_1.EventNamingStyle.lowerCaseWithoutOnPrefix:
|
|
68
69
|
outputEventName = `${eventNamePrefix}${inputEventName.replace(/^on/, '')}`.toLowerCase();
|
|
69
70
|
break;
|
|
70
71
|
}
|
|
@@ -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,sDAAoE;AAEpE,mCAA6E;AAO7E,MAAa,kBAAkB;IAsB7B,YAAY,aAAuB;QApBzB,sBAAiB,GAAkB,EAAE,CAAC;QAGhD,qBAAgB,GAAG,wBAAg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K,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;AAzLD,gDAyLC"}
|
package/dist/commonjs/index.d.ts
CHANGED
package/dist/commonjs/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -10,5 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
15
|
};
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./basePubSub.service"), exports);
|
|
13
18
|
__exportStar(require("./eventPubSub.service"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
14
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,wDAAsC;AACtC,0CAAwB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare enum EventNamingStyle {
|
|
2
|
+
/** Event name showing in Camel Case, so "onValidationError" would stay as "onValidationError" */
|
|
3
|
+
camelCase = "camelCase",
|
|
4
|
+
/** Event name showing in Kebab Case, so "onValidationError" would become "on-validation-error" */
|
|
5
|
+
kebabCase = "kebabCase",
|
|
6
|
+
/** Event name showing all in lowercase, so "onValidationError" would become "onvalidationerror" */
|
|
7
|
+
lowerCase = "lowerCase",
|
|
8
|
+
/** Event name showing all in lowercase but without the "on" prefix, so "onValidationError" would become "validationerror" */
|
|
9
|
+
lowerCaseWithoutOnPrefix = "lowerCaseWithoutOnPrefix"
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventNamingStyle = void 0;
|
|
4
|
+
var EventNamingStyle;
|
|
5
|
+
(function (EventNamingStyle) {
|
|
6
|
+
/** Event name showing in Camel Case, so "onValidationError" would stay as "onValidationError" */
|
|
7
|
+
EventNamingStyle["camelCase"] = "camelCase";
|
|
8
|
+
/** Event name showing in Kebab Case, so "onValidationError" would become "on-validation-error" */
|
|
9
|
+
EventNamingStyle["kebabCase"] = "kebabCase";
|
|
10
|
+
/** Event name showing all in lowercase, so "onValidationError" would become "onvalidationerror" */
|
|
11
|
+
EventNamingStyle["lowerCase"] = "lowerCase";
|
|
12
|
+
/** Event name showing all in lowercase but without the "on" prefix, so "onValidationError" would become "validationerror" */
|
|
13
|
+
EventNamingStyle["lowerCaseWithoutOnPrefix"] = "lowerCaseWithoutOnPrefix";
|
|
14
|
+
})(EventNamingStyle = exports.EventNamingStyle || (exports.EventNamingStyle = {}));
|
|
15
|
+
//# sourceMappingURL=eventNamingStyle.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventNamingStyle.enum.js","sourceRoot":"","sources":["../../../src/types/eventNamingStyle.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,gBAYX;AAZD,WAAY,gBAAgB;IAC1B,iGAAiG;IACjG,2CAAuB,CAAA;IAEvB,kGAAkG;IAClG,2CAAuB,CAAA;IAEvB,mGAAmG;IACnG,2CAAuB,CAAA;IAEvB,6HAA6H;IAC7H,yEAAqD,CAAA;AACvD,CAAC,EAZW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAY3B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface EventSubscription {
|
|
2
|
+
/** Disposes the subscription. */
|
|
3
|
+
dispose?: () => void;
|
|
4
|
+
/** Disposes the resources held by the subscription. */
|
|
5
|
+
unsubscribe?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export interface Subscription {
|
|
8
|
+
/** Disposes the resources held by the subscription. */
|
|
9
|
+
unsubscribe: () => void;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventSubscription.interface.js","sourceRoot":"","sources":["../../../src/types/eventSubscription.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./eventNamingStyle.enum"), exports);
|
|
18
|
+
__exportStar(require("./eventSubscription.interface"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,gEAA8C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { EventSubscription } from './types';
|
|
2
|
+
export declare abstract class BasePubSubService {
|
|
3
|
+
/**
|
|
4
|
+
* Method to publish a message
|
|
5
|
+
* @param event The event or channel to publish to.
|
|
6
|
+
* @param data The data to publish on the channel.
|
|
7
|
+
*/
|
|
8
|
+
publish<T = any>(_eventName: string | any, _data?: T, _delay?: number): void | boolean | Promise<boolean>;
|
|
9
|
+
/**
|
|
10
|
+
* Subscribes to a message channel or message type.
|
|
11
|
+
* @param event The event channel or event data type.
|
|
12
|
+
* @param callback The callback to be invoked when the specified message is published.
|
|
13
|
+
* @return possibly a Subscription
|
|
14
|
+
*/
|
|
15
|
+
subscribe<T = any>(_eventName: string | Function, _callback: (data: T) => void): EventSubscription | any;
|
|
16
|
+
/**
|
|
17
|
+
* Subscribes to a custom event message channel or message type.
|
|
18
|
+
* 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"
|
|
19
|
+
* @param event The event channel or event data type.
|
|
20
|
+
* @param callback The callback to be invoked when the specified message is published.
|
|
21
|
+
* @return possibly a Subscription
|
|
22
|
+
*/
|
|
23
|
+
subscribeEvent?<T = any>(_eventName: string | Function, _callback: (event: CustomEventInit<T>) => void): EventSubscription | any;
|
|
24
|
+
/**
|
|
25
|
+
* Unsubscribes a message name
|
|
26
|
+
* @param event The event name
|
|
27
|
+
* @return possibly a Subscription
|
|
28
|
+
*/
|
|
29
|
+
unsubscribe(_eventName: string, _callback: (event: CustomEventInit) => void): void;
|
|
30
|
+
/** Unsubscribes all subscriptions that currently exists */
|
|
31
|
+
unsubscribeAll(_subscriptions?: EventSubscription[]): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export class BasePubSubService {
|
|
2
|
+
/**
|
|
3
|
+
* Method to publish a message
|
|
4
|
+
* @param event The event or channel to publish to.
|
|
5
|
+
* @param data The data to publish on the channel.
|
|
6
|
+
*/
|
|
7
|
+
publish(_eventName, _data, _delay) {
|
|
8
|
+
throw new Error('BasePubSubService "publish" method must be implemented');
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Subscribes to a message channel or message type.
|
|
12
|
+
* @param event The event channel or event data type.
|
|
13
|
+
* @param callback The callback to be invoked when the specified message is published.
|
|
14
|
+
* @return possibly a Subscription
|
|
15
|
+
*/
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
17
|
+
subscribe(_eventName, _callback) {
|
|
18
|
+
throw new Error('BasePubSubService "subscribe" method must be implemented');
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Subscribes to a custom event message channel or message type.
|
|
22
|
+
* 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"
|
|
23
|
+
* @param event The event channel or event data type.
|
|
24
|
+
* @param callback The callback to be invoked when the specified message is published.
|
|
25
|
+
* @return possibly a Subscription
|
|
26
|
+
*/
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
28
|
+
subscribeEvent(_eventName, _callback) {
|
|
29
|
+
throw new Error('BasePubSubService "subscribeEvent" method must be implemented');
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Unsubscribes a message name
|
|
33
|
+
* @param event The event name
|
|
34
|
+
* @return possibly a Subscription
|
|
35
|
+
*/
|
|
36
|
+
unsubscribe(_eventName, _callback) {
|
|
37
|
+
throw new Error('BasePubSubService "unsubscribe" method must be implemented');
|
|
38
|
+
}
|
|
39
|
+
/** Unsubscribes all subscriptions that currently exists */
|
|
40
|
+
unsubscribeAll(_subscriptions) {
|
|
41
|
+
throw new Error('BasePubSubService "unsubscribeAll" method must be implemented');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=basePubSub.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basePubSub.service.js","sourceRoot":"","sources":["../../src/basePubSub.service.ts"],"names":[],"mappings":"AAGA,MAAM,OAAgB,iBAAiB;IACrC;;;;OAIG;IACH,OAAO,CAAU,UAAwB,EAAE,KAAS,EAAE,MAAe;QACnE,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;QAKI;IACJ,wDAAwD;IACxD,SAAS,CAAU,UAA6B,EAAE,SAA4B;QAC5E,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;IAED;;;;;;QAMI;IACJ,wDAAwD;IACxD,cAAc,CAAW,UAA6B,EAAE,SAA8C;QACpG,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACnF,CAAC;IAED;;;;QAII;IACJ,WAAW,CAAC,UAAkB,EAAE,SAA2C;QACzE,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAChF,CAAC;IAED,2DAA2D;IAC3D,cAAc,CAAC,cAAoC;QACjD,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACnF,CAAC;CACF"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BasePubSubService } from './basePubSub.service';
|
|
2
|
+
import { EventNamingStyle, EventSubscription, Subscription } from './types';
|
|
2
3
|
export interface PubSubEvent<T = any> {
|
|
3
4
|
name: string;
|
|
4
5
|
listener: (event: T | CustomEventInit<T>) => void;
|
|
5
6
|
}
|
|
6
|
-
export declare class EventPubSubService implements
|
|
7
|
+
export declare class EventPubSubService implements BasePubSubService {
|
|
7
8
|
protected _elementSource: Element;
|
|
8
9
|
protected _subscribedEvents: PubSubEvent[];
|
|
9
10
|
protected _timer: any;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { titleCase, toKebabCase } from '@slickgrid-universal/utils';
|
|
2
|
+
import { EventNamingStyle, } from './types';
|
|
2
3
|
export class EventPubSubService {
|
|
3
4
|
constructor(elementSource) {
|
|
4
5
|
this._subscribedEvents = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventPubSub.service.js","sourceRoot":"","sources":["../../src/eventPubSub.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"eventPubSub.service.js","sourceRoot":"","sources":["../../src/eventPubSub.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,EAAE,gBAAgB,GAAoC,MAAM,SAAS,CAAC;AAO7E,MAAM,OAAO,kBAAkB;IAsB7B,YAAY,aAAuB;QApBzB,sBAAiB,GAAkB,EAAE,CAAC;QAGhD,qBAAgB,GAAG,gBAAgB,CAAC,SAAS,CAAC;QAkB5C,2BAA2B;QAC3B,6GAA6G;QAC7G,IAAI,CAAC,cAAc,GAAG,aAAa,IAAI,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACvE,CAAC;IAnBD,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IACD,IAAI,aAAa,CAAC,OAAgB;QAChC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;IAChC,CAAC;IAED,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,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Y,uBAAZ,YAAY,CAAE,OAAO,EAAE;oBACzB,YAAY,CAAC,OAAO,EAAE,CAAC;iBACxB;qBAAM,IAAI,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,WAAW,EAAE;oBACpC,YAAY,CAAC,WAAW,EAAE,CAAC;iBAC5B;aACF,QAAQ,YAAY,EAAE;SACxB;aAAM;YACL,IAAI,WAAW,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,CAAC;YAC/C,OAAO,WAAW,EAAE;gBAClB,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;gBAChE,WAAW,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,CAAC;aAC5C;SACF;IACH,CAAC;IAED,KAAK;IACL,sBAAsB;IACtB,uBAAuB;IAEb,8BAA8B,CAAI,SAAiB,EAAE,QAAiD;QAC9G,MAAM,QAAQ,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,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/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare enum EventNamingStyle {
|
|
2
|
+
/** Event name showing in Camel Case, so "onValidationError" would stay as "onValidationError" */
|
|
3
|
+
camelCase = "camelCase",
|
|
4
|
+
/** Event name showing in Kebab Case, so "onValidationError" would become "on-validation-error" */
|
|
5
|
+
kebabCase = "kebabCase",
|
|
6
|
+
/** Event name showing all in lowercase, so "onValidationError" would become "onvalidationerror" */
|
|
7
|
+
lowerCase = "lowerCase",
|
|
8
|
+
/** Event name showing all in lowercase but without the "on" prefix, so "onValidationError" would become "validationerror" */
|
|
9
|
+
lowerCaseWithoutOnPrefix = "lowerCaseWithoutOnPrefix"
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export var EventNamingStyle;
|
|
2
|
+
(function (EventNamingStyle) {
|
|
3
|
+
/** Event name showing in Camel Case, so "onValidationError" would stay as "onValidationError" */
|
|
4
|
+
EventNamingStyle["camelCase"] = "camelCase";
|
|
5
|
+
/** Event name showing in Kebab Case, so "onValidationError" would become "on-validation-error" */
|
|
6
|
+
EventNamingStyle["kebabCase"] = "kebabCase";
|
|
7
|
+
/** Event name showing all in lowercase, so "onValidationError" would become "onvalidationerror" */
|
|
8
|
+
EventNamingStyle["lowerCase"] = "lowerCase";
|
|
9
|
+
/** Event name showing all in lowercase but without the "on" prefix, so "onValidationError" would become "validationerror" */
|
|
10
|
+
EventNamingStyle["lowerCaseWithoutOnPrefix"] = "lowerCaseWithoutOnPrefix";
|
|
11
|
+
})(EventNamingStyle || (EventNamingStyle = {}));
|
|
12
|
+
//# sourceMappingURL=eventNamingStyle.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventNamingStyle.enum.js","sourceRoot":"","sources":["../../../src/types/eventNamingStyle.enum.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,gBAYX;AAZD,WAAY,gBAAgB;IAC1B,iGAAiG;IACjG,2CAAuB,CAAA;IAEvB,kGAAkG;IAClG,2CAAuB,CAAA;IAEvB,mGAAmG;IACnG,2CAAuB,CAAA;IAEvB,6HAA6H;IAC7H,yEAAqD,CAAA;AACvD,CAAC,EAZW,gBAAgB,KAAhB,gBAAgB,QAY3B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface EventSubscription {
|
|
2
|
+
/** Disposes the subscription. */
|
|
3
|
+
dispose?: () => void;
|
|
4
|
+
/** Disposes the resources held by the subscription. */
|
|
5
|
+
unsubscribe?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export interface Subscription {
|
|
8
|
+
/** Disposes the resources held by the subscription. */
|
|
9
|
+
unsubscribe: () => void;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventSubscription.interface.js","sourceRoot":"","sources":["../../../src/types/eventSubscription.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slickgrid-universal/event-pub-sub",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
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",
|
|
@@ -13,16 +13,13 @@
|
|
|
13
13
|
"/dist"
|
|
14
14
|
],
|
|
15
15
|
"scripts": {
|
|
16
|
-
"build": "
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"dev": "
|
|
20
|
-
"dev:watch": "run-p build:watch --npm-path npm",
|
|
16
|
+
"build": "pnpm run bundle:commonjs",
|
|
17
|
+
"build:watch": "tsc --incremental --watch",
|
|
18
|
+
"dev": "pnpm run bundle:commonjs",
|
|
19
|
+
"dev:watch": "tsc --incremental --watch",
|
|
21
20
|
"bundle": "run-p bundle:commonjs bundle:esm --npm-path npm",
|
|
22
21
|
"bundle:commonjs": "tsc --project tsconfig.bundle.json --outDir dist/commonjs --module commonjs",
|
|
23
|
-
"bundle:esm": "
|
|
24
|
-
"prebundle": "npm-run-all delete:dist --npm-path npm",
|
|
25
|
-
"delete:dist": "cross-env rimraf --maxBusyTries=10 dist",
|
|
22
|
+
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018",
|
|
26
23
|
"package:add-browser-prop": "cross-env node ../change-package-browser.js --add-browser=true --folder-name=event-pub-sub",
|
|
27
24
|
"package:remove-browser-prop": "cross-env node ../change-package-browser.js --remove-browser=true --folder-name=event-pub-sub"
|
|
28
25
|
},
|
|
@@ -37,22 +34,17 @@
|
|
|
37
34
|
"bugs": {
|
|
38
35
|
"url": "https://github.com/ghiscoding/slickgrid-universal/issues"
|
|
39
36
|
},
|
|
40
|
-
"engines": {
|
|
41
|
-
"node": ">=14.17.0",
|
|
42
|
-
"npm": ">=6.14.8"
|
|
43
|
-
},
|
|
44
37
|
"browserslist": [
|
|
45
38
|
"last 2 version",
|
|
46
39
|
"> 1%",
|
|
47
40
|
"not dead"
|
|
48
41
|
],
|
|
49
42
|
"dependencies": {
|
|
50
|
-
"@slickgrid-universal/
|
|
43
|
+
"@slickgrid-universal/utils": "1.3.0"
|
|
51
44
|
},
|
|
52
45
|
"devDependencies": {
|
|
53
46
|
"cross-env": "^7.0.3",
|
|
54
|
-
"npm-run-
|
|
55
|
-
"rimraf": "^3.0.2"
|
|
47
|
+
"npm-run-all2": "^6.0.1"
|
|
56
48
|
},
|
|
57
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "e36e97bc03591af0e15c50397aadf34530e58156"
|
|
58
50
|
}
|