Chromium Code Reviews| Index: chrome/browser/resources/md_history/app.js |
| diff --git a/chrome/browser/resources/md_history/app.js b/chrome/browser/resources/md_history/app.js |
| index c0dbb18a500611cfc0f8a7e112cfe6348a483d02..774449360b619897bc8e7d218b9c3103bbe8e5a1 100644 |
| --- a/chrome/browser/resources/md_history/app.js |
| +++ b/chrome/browser/resources/md_history/app.js |
| @@ -107,13 +107,28 @@ Polymer({ |
| 'unselect-all': 'unselectAll', |
| }, |
| + /** @private {?function(!Event)} */ |
| + onCanExecuteListener_: null, |
| + |
| + /** @private {?function(!Event)} */ |
| + onCommandListener_: null, |
| + |
| /** @override */ |
| - ready: function() { |
| + attached: function() { |
| this.grouped_ = loadTimeData.getBoolean('groupByDomain'); |
| cr.ui.decorate('command', cr.ui.Command); |
| - document.addEventListener('canExecute', this.onCanExecute_.bind(this)); |
| - document.addEventListener('command', this.onCommand_.bind(this)); |
| + this.onCanExecuteListener_ = this.onCanExecute_.bind(this); |
|
Dan Beam
2016/11/03 18:07:51
nit: boundOnCanExecute_ seems to be the typical po
tsergeant
2016/11/03 22:34:32
Done.
|
| + this.onCommandListener_ = this.onCommand_.bind(this); |
| + |
| + document.addEventListener('canExecute', this.onCanExecuteListener_); |
| + document.addEventListener('command', this.onCommandListener_); |
| + }, |
| + |
| + /** @override */ |
| + detached: function() { |
| + document.removeEventListener('canExecute', this.onCanExecuteListener_); |
| + document.removeEventListener('command', this.onCommandListener_); |
| }, |
| onFirstRender: function() { |