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: 'bookmarks-list', | 6 is: 'bookmarks-list', |
| 7 | 7 |
| 8 behaviors: [ | 8 behaviors: [ |
| 9 bookmarks.StoreClient, | 9 bookmarks.StoreClient, |
| 10 ], | 10 ], |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 * focus on incremental update. | 63 * focus on incremental update. |
| 64 * @param {Array<string>} newValue | 64 * @param {Array<string>} newValue |
| 65 * @param {Array<string>} oldValue | 65 * @param {Array<string>} oldValue |
| 66 */ | 66 */ |
| 67 onDisplayedIdsChanged_: function(newValue, oldValue) { | 67 onDisplayedIdsChanged_: function(newValue, oldValue) { |
| 68 if (!oldValue) { | 68 if (!oldValue) { |
| 69 this.displayedList_ = this.displayedIds_.map(function(id) { | 69 this.displayedList_ = this.displayedIds_.map(function(id) { |
| 70 return {id: id}; | 70 return {id: id}; |
| 71 }); | 71 }); |
| 72 } else { | 72 } else { |
| 73 var splices = Polymer.ArraySplice.calculateSplices(newValue, oldValue); | 73 var splices = Polymer.ArraySplice.calculateSplices( |
| 74 /** @type {!Array<string>}*/ (newValue), | |
|
dpapad
2017/05/24 21:22:13
Nit: Space after "}"
/** @type {!Array<string>} */
scottchen
2017/05/25 19:31:26
There's issues with patching a CL with a jar invol
dpapad
2017/05/25 20:34:40
OK.
| |
| 75 /** @type {!Array<string>}*/ (oldValue)); | |
| 74 splices.forEach(function(splice) { | 76 splices.forEach(function(splice) { |
| 75 // TODO(calamity): Could use notifySplices to improve performance here. | 77 // TODO(calamity): Could use notifySplices to improve performance here. |
| 76 var additions = | 78 var additions = |
| 77 newValue.slice(splice.index, splice.index + splice.addedCount) | 79 newValue.slice(splice.index, splice.index + splice.addedCount) |
| 78 .map(function(id) { | 80 .map(function(id) { |
| 79 return {id: id}; | 81 return {id: id}; |
| 80 }); | 82 }); |
| 81 this.splice.apply(this, [ | 83 this.splice.apply(this, [ |
| 82 'displayedList_', splice.index, splice.removed.length | 84 'displayedList_', splice.index, splice.removed.length |
| 83 ].concat(additions)); | 85 ].concat(additions)); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 94 /** @private */ | 96 /** @private */ |
| 95 isEmptyList_: function() { | 97 isEmptyList_: function() { |
| 96 return this.displayedList_.length == 0; | 98 return this.displayedList_.length == 0; |
| 97 }, | 99 }, |
| 98 | 100 |
| 99 /** @private */ | 101 /** @private */ |
| 100 deselectItems_: function() { | 102 deselectItems_: function() { |
| 101 this.dispatch(bookmarks.actions.deselectItems()); | 103 this.dispatch(bookmarks.actions.deselectItems()); |
| 102 }, | 104 }, |
| 103 }); | 105 }); |
| OLD | NEW |