| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 Polymer({ | 5 Polymer({ |
| 6 /** | 6 /** |
| 7 * This element is a one way bound interface that routes the page URL to | 7 * This element is a one way bound interface that routes the page URL to |
| 8 * the searchTerm and selectedId. Clients must initialize themselves by | 8 * the searchTerm and selectedId. Clients must initialize themselves by |
| 9 * reading the router's fields after attach. | 9 * reading the router's fields after attach. |
| 10 */ | 10 */ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 }, | 28 }, |
| 29 | 29 |
| 30 observers: [ | 30 observers: [ |
| 31 'onQueryChanged_(queryParams_.*)', | 31 'onQueryChanged_(queryParams_.*)', |
| 32 ], | 32 ], |
| 33 | 33 |
| 34 /** @private */ | 34 /** @private */ |
| 35 onQueryChanged_: function() { | 35 onQueryChanged_: function() { |
| 36 this.searchTerm = this.queryParams_.q || ''; | 36 this.searchTerm = this.queryParams_.q || ''; |
| 37 this.selectedId = this.queryParams_.id; | 37 this.selectedId = this.queryParams_.id; |
| 38 | 38 this.fire('selected-folder-changed', {id: this.selectedId}); |
| 39 if (this.searchTerm) | 39 this.fire('search-term-changed', this.searchTerm); |
| 40 this.fire('search-term-changed', this.searchTerm); | |
| 41 else | |
| 42 this.fire('selected-folder-changed', this.selectedId); | |
| 43 }, | 40 }, |
| 44 | 41 |
| 45 /** @private */ | 42 /** @private */ |
| 46 onSelectedIdChanged_: function() { | 43 onSelectedIdChanged_: function() { |
| 47 this.set('queryParams_.id', this.selectedId || null); | 44 this.set('queryParams_.id', this.selectedId || null); |
| 48 }, | 45 }, |
| 49 | 46 |
| 50 /** @private */ | 47 /** @private */ |
| 51 onSearchTermChanged_: function() { | 48 onSearchTermChanged_: function() { |
| 52 this.set('queryParams_.q', this.searchTerm || null); | 49 this.set('queryParams_.q', this.searchTerm || null); |
| 53 }, | 50 }, |
| 54 }); | 51 }); |
| OLD | NEW |