Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(743)

Side by Side Diff: chrome/browser/resources/md_bookmarks/store_client.js

Issue 2735953002: MD Bookmarks: Integrate new data store with UI elements (Closed)
Patch Set: calamity@ review Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 /** 5 /**
6 * @fileoverview Defines StoreClient, a Polymer behavior to tie a front-end 6 * @fileoverview Defines StoreClient, a Polymer behavior to tie a front-end
7 * element to back-end data from the store. 7 * element to back-end data from the store.
8 */ 8 */
9 9
10 cr.define('bookmarks', function() { 10 cr.define('bookmarks', function() {
(...skipping 22 matching lines...) Expand all
33 33
34 /** 34 /**
35 * Watches a particular part of the state tree, updating |localProperty| 35 * Watches a particular part of the state tree, updating |localProperty|
36 * to the return value of |valueGetter| whenever the state changes. Eg, to 36 * to the return value of |valueGetter| whenever the state changes. Eg, to
37 * keep |this.item| updated with the value of a node: 37 * keep |this.item| updated with the value of a node:
38 * watch('item', (state) => state.nodes[this.itemId]); 38 * watch('item', (state) => state.nodes[this.itemId]);
39 * 39 *
40 * Note that object identity is used to determine if the value has changed 40 * Note that object identity is used to determine if the value has changed
41 * before updating the UI, rather than Polymer-style deep equality. 41 * before updating the UI, rather than Polymer-style deep equality.
42 * 42 *
43 * Typechecking is supressed because this conflicts with
44 * Object.prototype.watch, which is a Gecko-only method that is recognized
45 * by Closure.
46 * @suppress {checkTypes}
43 * @param {string} localProperty 47 * @param {string} localProperty
44 * @param {function(!BookmarksPageState)} valueGetter 48 * @param {function(!BookmarksPageState)} valueGetter
45 */ 49 */
46 watch: function(localProperty, valueGetter) { 50 watch: function(localProperty, valueGetter) {
47 // TODO(tsergeant): Warn if localProperty is not a defined property. 51 // TODO(tsergeant): Warn if localProperty is not a defined property.
48 this.watches_.push({ 52 this.watches_.push({
49 localProperty: localProperty, 53 localProperty: localProperty,
50 valueGetter: valueGetter, 54 valueGetter: valueGetter,
51 }); 55 });
52 }, 56 },
(...skipping 27 matching lines...) Expand all
80 if (bookmarks.Store.getInstance().isInitialized()) 84 if (bookmarks.Store.getInstance().isInitialized())
81 this.onStateChanged(bookmarks.Store.getInstance().data); 85 this.onStateChanged(bookmarks.Store.getInstance().data);
82 }, 86 },
83 87
84 /** @return {!BookmarksPageState} */ 88 /** @return {!BookmarksPageState} */
85 getState: function() { 89 getState: function() {
86 return bookmarks.Store.getInstance().data; 90 return bookmarks.Store.getInstance().data;
87 }, 91 },
88 }; 92 };
89 93
90 return {StoreClient: StoreClient}; 94 return {
95 StoreClient: StoreClient,
96 };
91 }); 97 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_bookmarks/sidebar.js ('k') | chrome/browser/ui/webui/md_bookmarks/md_bookmarks_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698