couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [06/12] fauxton commit: updated refs/heads/import-master to 6827677
Date Thu, 15 May 2014 21:50:51 GMT
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-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/bc6ab654
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/bc6ab654
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/bc6ab654

Branch: refs/heads/import-master
Commit: bc6ab654c50f723ba0744fa7f9d7ff2d7f80d1d5
Parents: 2257d7b
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

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


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bc6ab654/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js
index 896f19b..2df3ab6 100644
--- a/app/addons/documents/views.js
+++ b/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