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: [ | |
9 bookmarks.StoreClient, | |
10 ], | |
11 | |
8 properties: { | 12 properties: { |
9 /** @type {BookmarkTreeNode} */ | 13 /** @type {BookmarkNode} */ |
10 menuItem_: Object, | 14 menuItem_: Object, |
11 | 15 |
12 /** @type {Array<BookmarkTreeNode>} */ | 16 /** @type {Array<string>} */ |
13 displayedList: Array, | 17 displayedList: { |
18 type: Array, | |
19 value: function() { | |
20 return []; | |
calamity
2017/03/09 04:58:57
Why is this necessary?
tsergeant
2017/03/09 06:27:54
This is a little fix to prevent the flash of an em
calamity
2017/03/10 03:34:21
Ah yeah, I thought it might be. Good riddance. I'm
| |
21 }, | |
22 }, | |
14 | 23 |
15 searchTerm: String, | 24 searchTerm: String, |
16 }, | 25 }, |
17 | 26 |
18 listeners: { | 27 listeners: { |
19 'open-item-menu': 'onOpenItemMenu_', | 28 'open-item-menu': 'onOpenItemMenu_', |
20 }, | 29 }, |
21 | 30 |
31 attached: function() { | |
32 this.watch('displayedList', function(state) { | |
33 return bookmarks.util.getDisplayedList(state); | |
34 }); | |
35 this.updateFromStore(); | |
36 }, | |
37 | |
22 /** | 38 /** |
23 * @param {Event} e | 39 * @param {Event} e |
24 * @private | 40 * @private |
25 */ | 41 */ |
26 onOpenItemMenu_: function(e) { | 42 onOpenItemMenu_: function(e) { |
27 this.menuItem_ = e.detail.item; | 43 this.menuItem_ = e.detail.item; |
28 var menu = /** @type {!CrActionMenuElement} */ ( | 44 var menu = /** @type {!CrActionMenuElement} */ ( |
29 this.$.dropdown); | 45 this.$.dropdown); |
30 menu.showAt(/** @type {!Element} */ (e.detail.target)); | 46 menu.showAt(/** @type {!Element} */ (e.detail.target)); |
31 }, | 47 }, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 emptyListMessage_: function() { | 113 emptyListMessage_: function() { |
98 var emptyListMessage = this.searchTerm ? 'noSearchResults' : 'emptyList'; | 114 var emptyListMessage = this.searchTerm ? 'noSearchResults' : 'emptyList'; |
99 return loadTimeData.getString(emptyListMessage); | 115 return loadTimeData.getString(emptyListMessage); |
100 }, | 116 }, |
101 | 117 |
102 /** @private */ | 118 /** @private */ |
103 isEmptyList_: function() { | 119 isEmptyList_: function() { |
104 return this.displayedList.length == 0; | 120 return this.displayedList.length == 0; |
105 }, | 121 }, |
106 }); | 122 }); |
OLD | NEW |