-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): clear dataset when disposing and fix few unsubscribed even…
…ts to avoid leak (#156) * fix(core): do not keep dataset local copy avoid leak when disposing * fix: add unbindAll to BindingService to avoid detached events * fix(filters): any Filter should only trigger search callback once - some Filters have multiple events attached to the elements and in some cases it was calling multiple search filtering execution * fix: make sure to remove every event listeners when disposing
- Loading branch information
1 parent
073edd8
commit 78c80b4
Showing
75 changed files
with
1,150 additions
and
755 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
examples/webpack-demo-vanilla-bundle/src/examples/event.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
interface ElementEventListener { | ||
element: Element; | ||
eventName: string; | ||
listener: EventListenerOrEventListenerObject; | ||
} | ||
|
||
export class EventService { | ||
private _boundedEventWithListeners: ElementEventListener[] = []; | ||
|
||
addElementEventListener(element: Element, eventName: string, listener: EventListenerOrEventListenerObject) { | ||
element.addEventListener(eventName, listener); | ||
this._boundedEventWithListeners.push({ element, eventName, listener }); | ||
} | ||
|
||
/** Unbind All (remove) bounded elements with listeners */ | ||
unbindAllEvents() { | ||
for (const boundedEvent of this._boundedEventWithListeners) { | ||
const { element, eventName, listener } = boundedEvent; | ||
if (element?.removeEventListener) { | ||
element.removeEventListener(eventName, listener); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.