Skip to content

Commit 17e7fcd

Browse files
committed
fix: clear eventbus when destroying editor
1 parent 5835396 commit 17e7fcd

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/editor/core/event/eventbus/EventBus.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,8 @@ export class EventBus<EventMap> {
4343
const eventSet = this.eventHub.get(eventName)
4444
return !!eventSet && eventSet.size > 0
4545
}
46+
47+
public dangerouslyClearAll() {
48+
this.eventHub.clear()
49+
}
4650
}

src/editor/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export default class Editor {
152152
draw.destroy()
153153
shortcut.removeEvent()
154154
contextMenu.removeEvent()
155+
this.eventBus.dangerouslyClearAll()
155156
}
156157
// 插件
157158
const plugin = new Plugin(this)

0 commit comments

Comments
 (0)