couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject couchdb commit: updated refs/heads/master to ebade0f
Date Thu, 08 May 2014 17:41:31 GMT
Repository: couchdb
Updated Branches:
  refs/heads/master 2fe69e704 -> ebade0f2f


Fauxton: use .listenTo and not .on

There was no `.off` call on destroy, so these two Eventhandlers
where leaking memory


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/ebade0f2
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/ebade0f2
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/ebade0f2

Branch: refs/heads/master
Commit: ebade0f2f82d4da60e386f4aeaf24ecb98181e81
Parents: 2fe69e7
Author: Robert Kowalski <rok@kowalski.gd>
Authored: Wed May 7 20:22:36 2014 +0200
Committer: Robert Kowalski <rok@kowalski.gd>
Committed: Wed May 7 20:26:36 2014 +0200

----------------------------------------------------------------------
 src/fauxton/app/addons/documents/views.js | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/ebade0f2/src/fauxton/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js
index 896f19b..2df3ab6 100644
--- a/src/fauxton/app/addons/documents/views.js
+++ b/src/fauxton/app/addons/documents/views.js
@@ -928,7 +928,9 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
     },
 
     afterRender: function() {
-      var saveDoc = this.saveDoc;
+      var saveDoc = this.saveDoc,
+          editor,
+          model;
 
       this.editor = new Components.Editor({
         editorId: "editor-container",
@@ -943,12 +945,9 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
         }]
       });
       this.editor.render();
-      this.model.on("sync", this.updateValues, this);
 
-      var editor = this.editor,
-          model = this.model;
-
-      editor.editor.on("change", function (event) {
+      this.listenTo(this.model, "sync", this.updateValues);
+      this.listenTo(editor.editor, "change", function (event) {
         var changedDoc;
         try {
           changedDoc = JSON.parse(editor.getValue());
@@ -974,6 +973,9 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
           clear:  true
         });
       });
+
+      editor = this.editor;
+      model = this.model;
     },
 
     cleanup: function () {


Mime
View raw message