Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 is: 'history-router', | 6 is: 'history-router', |
| 7 | 7 |
| 8 properties: { | 8 properties: { |
| 9 selectedPage: { | 9 selectedPage: { |
| 10 type: String, | 10 type: String, |
| 11 observer: 'serializePath_', | 11 observer: 'serializePath_', |
| 12 notify: true, | 12 notify: true, |
| 13 }, | 13 }, |
| 14 | 14 |
| 15 /** @type {QueryState} */ | |
| 15 queryState: { | 16 queryState: { |
| 16 type: Object, | 17 type: Object, |
| 17 notify: true, | 18 notify: true, |
| 19 value: function() { | |
| 20 // TODO(tsergeant: Move this initialization into query-manager. | |
|
calamity
2017/01/17 06:22:10
Just wondering, why's this hard to do this patch?
tsergeant
2017/01/18 03:36:00
It's an initialization order thing.
If queryState
| |
| 21 return { | |
| 22 // Whether the most recent query was incremental. | |
| 23 incremental: false, | |
| 24 // A query is initiated by page load. | |
| 25 querying: true, | |
| 26 queryingDisabled: false, | |
| 27 _range: HistoryRange.ALL_TIME, | |
| 28 searchTerm: '', | |
| 29 groupedOffset: 0, | |
| 30 | |
| 31 set range(val) { | |
| 32 this._range = Number(val); | |
| 33 }, | |
| 34 get range() { | |
| 35 return this._range; | |
| 36 }, | |
| 37 }; | |
| 38 }, | |
| 18 }, | 39 }, |
| 19 | 40 |
| 20 path_: { | 41 path_: { |
| 21 type: String, | 42 type: String, |
| 22 observer: 'pathChanged_', | 43 observer: 'pathChanged_', |
| 23 }, | 44 }, |
| 24 | 45 |
| 25 queryParams_: Object, | 46 queryParams_: Object, |
| 26 }, | 47 }, |
| 27 | 48 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 54 /** @private */ | 75 /** @private */ |
| 55 queryParamsChanged_: function() { | 76 queryParamsChanged_: function() { |
| 56 this.set('queryState.searchTerm', this.queryParams_.q || ''); | 77 this.set('queryState.searchTerm', this.queryParams_.q || ''); |
| 57 }, | 78 }, |
| 58 | 79 |
| 59 /** @private */ | 80 /** @private */ |
| 60 searchTermChanged_: function() { | 81 searchTermChanged_: function() { |
| 61 this.set('queryParams_.q', this.queryState.searchTerm || null); | 82 this.set('queryParams_.q', this.queryState.searchTerm || null); |
| 62 }, | 83 }, |
| 63 }); | 84 }); |
| OLD | NEW |