Skip to content

Commit

Permalink
remove window resize listener when destroying the editor
Browse files Browse the repository at this point in the history
  • Loading branch information
nightwing committed Feb 13, 2013
1 parent 564310b commit 37d41ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/ace/ace.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
1 change: 1 addition & 0 deletions lib/ace/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2169,6 +2169,7 @@ var Editor = function(renderer, session) {
**/
this.destroy = function() {
this.renderer.destroy();
this._emit("destroy", this);
};

}).call(Editor.prototype);
Expand Down

0 comments on commit 37d41ab

Please sign in to comment.