remove window resize listener when destroying the editor
This commit is contained in:
parent
564310b040
commit
37d41ab6fd
2 changed files with 4 additions and 0 deletions
|
|
@ -94,6 +94,9 @@ exports.edit = function(el) {
|
||||||
onResize: editor.resize.bind(editor)
|
onResize: editor.resize.bind(editor)
|
||||||
};
|
};
|
||||||
event.addListener(window, "resize", env.onResize);
|
event.addListener(window, "resize", env.onResize);
|
||||||
|
editor.on("destroy", function() {
|
||||||
|
event.removeListener(window, "resize", env.onResize);
|
||||||
|
});
|
||||||
el.env = editor.env = env;
|
el.env = editor.env = env;
|
||||||
return editor;
|
return editor;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2169,6 +2169,7 @@ var Editor = function(renderer, session) {
|
||||||
**/
|
**/
|
||||||
this.destroy = function() {
|
this.destroy = function() {
|
||||||
this.renderer.destroy();
|
this.renderer.destroy();
|
||||||
|
this._emit("destroy", this);
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(Editor.prototype);
|
}).call(Editor.prototype);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue