Skip to content

Commit

Permalink
fix: stage events should be released
Browse files Browse the repository at this point in the history
  • Loading branch information
xile611 committed Mar 12, 2024
1 parent cb35856 commit 5aad4d3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/vgrammar-core/src/view/View.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,11 @@ export default class View extends EventEmitter implements IView {
stage && stage.on('*', this.delegateEvent);
}

private releaseStageEvent() {
const stage = this.renderer.stage();
stage && stage.off('*', this.delegateEvent);
}

private delegateEvent = (event: any, type: string) => {
const activeElement = event.target?.[BridgeElementKey];
const extendedEvt = getExtendedEvents(this, event, activeElement, type, EVENT_SOURCE_VIEW);
Expand Down Expand Up @@ -1513,6 +1518,7 @@ export default class View extends EventEmitter implements IView {

// --- release ---
release() {
this.releaseStageEvent();
this._unBindResizeEvent();
this.clearProgressive();
Factory.unregisterRuntimeTransforms();
Expand Down

0 comments on commit 5aad4d3

Please sign in to comment.