@slickgrid-universal/event-pub-sub
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -6,2 +6,13 @@ # Change Log | ||
## [1.2.1](https://github.com/ghiscoding/slickgrid-universal/compare/v1.2.0...v1.2.1) (2022-01-18) | ||
### Bug Fixes | ||
* **memory:** clear & dispose of grid to avoid mem leaks & detached elm ([7035db5](https://github.com/ghiscoding/slickgrid-universal/commit/7035db5f878187f6fb8b9d2effacb7443f25e2c9)) | ||
# [1.2.0](https://github.com/ghiscoding/slickgrid-universal/compare/v1.1.1...v1.2.0) (2022-01-06) | ||
@@ -8,0 +19,0 @@ |
@@ -9,2 +9,3 @@ import { EventNamingStyle, EventSubscription, PubSubService, Subscription } from '@slickgrid-universal/common'; | ||
protected _subscribedEvents: PubSubEvent[]; | ||
protected _timer: any; | ||
eventNamingStyle: EventNamingStyle; | ||
@@ -16,2 +17,3 @@ get elementSource(): Element; | ||
constructor(elementSource?: Element); | ||
dispose(): void; | ||
/** | ||
@@ -18,0 +20,0 @@ * Dispatch of Custom Event, which by default will bubble up & is cancelable |
@@ -25,2 +25,10 @@ "use strict"; | ||
} | ||
dispose() { | ||
var _a; | ||
this.unsubscribeAll(); | ||
this._subscribedEvents = []; | ||
clearTimeout(this._timer); | ||
(_a = this._elementSource) === null || _a === void 0 ? void 0 : _a.remove(); | ||
this._elementSource = null; | ||
} | ||
/** | ||
@@ -35,2 +43,3 @@ * Dispatch of Custom Event, which by default will bubble up & is cancelable | ||
dispatchCustomEvent(eventName, data, isBubbling = true, isCancelable = true) { | ||
var _a; | ||
const eventInit = { bubbles: isBubbling, cancelable: isCancelable }; | ||
@@ -40,3 +49,3 @@ if (data) { | ||
} | ||
return this._elementSource.dispatchEvent(new CustomEvent(eventName, eventInit)); | ||
return (_a = this._elementSource) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new CustomEvent(eventName, eventInit)); | ||
} | ||
@@ -82,3 +91,3 @@ /** | ||
return new Promise(resolve => { | ||
setTimeout(() => resolve(this.dispatchCustomEvent(eventNameByConvention, data, true, true)), delay); | ||
this._timer = setTimeout(() => resolve(this.dispatchCustomEvent(eventNameByConvention, data, true, true)), delay); | ||
}); | ||
@@ -85,0 +94,0 @@ } |
@@ -9,2 +9,3 @@ import { EventNamingStyle, EventSubscription, PubSubService, Subscription } from '@slickgrid-universal/common'; | ||
protected _subscribedEvents: PubSubEvent[]; | ||
protected _timer: any; | ||
eventNamingStyle: EventNamingStyle; | ||
@@ -16,2 +17,3 @@ get elementSource(): Element; | ||
constructor(elementSource?: Element); | ||
dispose(): void; | ||
/** | ||
@@ -18,0 +20,0 @@ * Dispatch of Custom Event, which by default will bubble up & is cancelable |
@@ -22,2 +22,10 @@ import { EventNamingStyle, titleCase, toKebabCase } from '@slickgrid-universal/common'; | ||
} | ||
dispose() { | ||
var _a; | ||
this.unsubscribeAll(); | ||
this._subscribedEvents = []; | ||
clearTimeout(this._timer); | ||
(_a = this._elementSource) === null || _a === void 0 ? void 0 : _a.remove(); | ||
this._elementSource = null; | ||
} | ||
/** | ||
@@ -32,2 +40,3 @@ * Dispatch of Custom Event, which by default will bubble up & is cancelable | ||
dispatchCustomEvent(eventName, data, isBubbling = true, isCancelable = true) { | ||
var _a; | ||
const eventInit = { bubbles: isBubbling, cancelable: isCancelable }; | ||
@@ -37,3 +46,3 @@ if (data) { | ||
} | ||
return this._elementSource.dispatchEvent(new CustomEvent(eventName, eventInit)); | ||
return (_a = this._elementSource) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new CustomEvent(eventName, eventInit)); | ||
} | ||
@@ -79,3 +88,3 @@ /** | ||
return new Promise(resolve => { | ||
setTimeout(() => resolve(this.dispatchCustomEvent(eventNameByConvention, data, true, true)), delay); | ||
this._timer = setTimeout(() => resolve(this.dispatchCustomEvent(eventNameByConvention, data, true, true)), delay); | ||
}); | ||
@@ -82,0 +91,0 @@ } |
{ | ||
"name": "@slickgrid-universal/event-pub-sub", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Simple Vanilla Implementation of an Event PubSub Service to do simply publish/subscribe inter-communication while optionally providing data in the event", | ||
@@ -50,3 +50,3 @@ "main": "dist/commonjs/index.js", | ||
"dependencies": { | ||
"@slickgrid-universal/common": "^1.2.0" | ||
"@slickgrid-universal/common": "^1.2.1" | ||
}, | ||
@@ -58,3 +58,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "af25eecf8994d5b6ec9eb13bfd266cba71c1cfcb" | ||
"gitHead": "11a05e9877ac0a42d53eaefb1edf95586dcd41b3" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
45620
502