remove window resize listener when destroying the editor

This commit is contained in:
nightwing 2013-02-14 01:02:24 +04:00
commit 37d41ab6fd
2 changed files with 4 additions and 0 deletions

View file

@ -94,6 +94,9 @@ exports.edit = function(el) {
onResize: editor.resize.bind(editor)
};
event.addListener(window, "resize", env.onResize);
editor.on("destroy", function() {
event.removeListener(window, "resize", env.onResize);
});
el.env = editor.env = env;
return editor;
};

View file

@ -2169,6 +2169,7 @@ var Editor = function(renderer, session) {
**/
this.destroy = function() {
this.renderer.destroy();
this._emit("destroy", this);
};
}).call(Editor.prototype);