Merge lp://staging/~bcsaller/juju-gui/detachfix into lp://staging/juju-gui/experimental

Proposed by Benjamin Saller
Status: Merged
Merged at revision: 875
Proposed branch: lp://staging/~bcsaller/juju-gui/detachfix
Merge into: lp://staging/juju-gui/experimental
Diff against target: 78 lines (+21/-20)
2 files modified
app/views/databinding.js (+5/-4)
test/test_databinding.js (+16/-16)
To merge this branch: bzr merge lp://staging/~bcsaller/juju-gui/detachfix
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+175923@code.staging.launchpad.net

Description of the change

Databinding unbind redux

The ongoing battle continues.

https://codereview.appspot.com/11433048/

To post a comment you must log in.
Revision history for this message
Benjamin Saller (bcsaller) wrote :

Reviewers: mp+175923_code.launchpad.net,

Message:
Please take a look.

Description:
Databinding unbind redux

The ongoing battle continues.

https://code.launchpad.net/~bcsaller/juju-gui/detachfix/+merge/175923

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/11433048/

Affected files:
   A [revision details]
   M app/views/databinding.js

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>

Index: app/views/databinding.js
=== modified file 'app/views/databinding.js'
--- app/views/databinding.js 2013-07-19 18:06:37 +0000
+++ app/views/databinding.js 2013-07-19 18:54:05 +0000
@@ -256,8 +256,9 @@
          // This typically depends on an Object.observe polyfill being
          // in place (which it is). As browsers natively support this
          // we can one day drop the polyfill.
- modelEventHandles.push(
- Object.observe(model, Y.bind(this._modelChangeHandler, this)));
+ var callback = Y.bind(this._modelChangeHandler, this);
+ Object.observe(model, callback);
+ modelEventHandles.push({model: model, callback: callback});
        }

        // Bind and listen for model changes.
@@ -357,7 +358,7 @@
            if (handle.detach) {
              handle.detach();
            } else {
- Object.unobserve(handle, self._modelChangeHandler);
+ Object.unobserve(handle.model, handle.callback);
            }
          });
          handles.splice(0, handles.length);
@@ -386,7 +387,7 @@
          if (handle.detach) {
            handle.detach();
          } else {
- Object.unobserve(handle, self._modelChangeHandler);
+ Object.unobserve(handle.model, handle.callback);
          }
        });
        // Empty the list

Revision history for this message
Richard Harding (rharding) wrote :

LGTM, thanks a ton for helping with this!

https://codereview.appspot.com/11433048/

Revision history for this message
Madison Scott-Clary (makyo) wrote :
876. By Benjamin Saller

test the unbind properly

877. By Benjamin Saller

test the unbind properly

Revision history for this message
Benjamin Saller (bcsaller) wrote :
Revision history for this message
Benjamin Saller (bcsaller) wrote :

*** Submitted:

Databinding unbind redux

The ongoing battle continues.

R=rharding, matthew.scott
CC=
https://codereview.appspot.com/11433048

https://codereview.appspot.com/11433048/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches