Skip to content

Commit

Permalink
解决 listener 为 undefined 的时候卸载错误
Browse files Browse the repository at this point in the history
解决 listener 为 undefined 的时候卸载错误
  • Loading branch information
ylx252 authored Mar 25, 2024
1 parent 4f23284 commit e1e504f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/core/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ class Editor extends EventEmitter {
_initServersPlugin() {
this.use(ServersPlugin, {});
}

// 解决 listener 为 undefined 的时候卸载错误
off<K>(eventName, listener): this {
// noinspection TypeScriptValidateTypes
return listener ? super.off(eventName, listener) : this;
}
}

export default Editor;

0 comments on commit e1e504f

Please sign in to comment.