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

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

Issue 2813503002: MD Bookmarks: Prevent navigating to invalid folders (Closed)
Patch Set: Rebase & Implement deferred actions Created 3 years, 7 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // TODO(tsergeant): Warn if localProperty is not a defined property. 52 // TODO(tsergeant): Warn if localProperty is not a defined property.
53 this.watches_.push({ 53 this.watches_.push({
54 localProperty: localProperty, 54 localProperty: localProperty,
55 valueGetter: valueGetter, 55 valueGetter: valueGetter,
56 }); 56 });
57 }, 57 },
58 58
59 /** 59 /**
60 * Helper to dispatch an action to the store, which will update the store 60 * Helper to dispatch an action to the store, which will update the store
61 * data and then (possibly) flow through to the UI. 61 * data and then (possibly) flow through to the UI.
62 * @param {Action} action 62 * @param {?Action|DeferredAction} action
63 */ 63 */
64 dispatch: function(action) { 64 dispatch: function(action) {
65 bookmarks.Store.getInstance().handleAction(action); 65 bookmarks.Store.getInstance().handleAction(action);
66 }, 66 },
67 67
68 /** @param {string} newState */ 68 /** @param {string} newState */
69 onStateChanged: function(newState) { 69 onStateChanged: function(newState) {
70 this.watches_.forEach(function(watch) { 70 this.watches_.forEach(function(watch) {
71 var oldValue = this[watch.localProperty]; 71 var oldValue = this[watch.localProperty];
72 var newValue = watch.valueGetter(newState); 72 var newValue = watch.valueGetter(newState);
(...skipping 16 matching lines...) Expand all
89 /** @return {!BookmarksPageState} */ 89 /** @return {!BookmarksPageState} */
90 getState: function() { 90 getState: function() {
91 return bookmarks.Store.getInstance().data; 91 return bookmarks.Store.getInstance().data;
92 }, 92 },
93 }; 93 };
94 94
95 return { 95 return {
96 StoreClient: StoreClient, 96 StoreClient: StoreClient,
97 }; 97 };
98 }); 98 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698