| OLD | NEW |
| 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 A singleton datastore for the Bookmarks page. Page state is | 6 * @fileoverview A singleton datastore for the Bookmarks page. Page state is |
| 7 * publicly readable, but can only be modified by dispatching an Action to | 7 * publicly readable, but can only be modified by dispatching an Action to |
| 8 * the store. | 8 * the store. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 cr.define('bookmarks', function() { | 11 cr.define('bookmarks', function() { |
| 12 /** @constructor */ | 12 /** @constructor */ |
| 13 function Store() { | 13 function Store() { |
| 14 /** @type {!BookmarksPageState} */ | 14 /** @type {!BookmarksPageState} */ |
| 15 this.data_ = {}; | 15 this.data_ = bookmarks.util.createEmptyState(); |
| 16 /** @type {boolean} */ | 16 /** @type {boolean} */ |
| 17 this.initialized_ = false; | 17 this.initialized_ = false; |
| 18 /** @type {!Array<!StoreObserver>} */ | 18 /** @type {!Array<!StoreObserver>} */ |
| 19 this.observers_ = []; | 19 this.observers_ = []; |
| 20 } | 20 } |
| 21 | 21 |
| 22 Store.prototype = { | 22 Store.prototype = { |
| 23 /** | 23 /** |
| 24 * @param {!BookmarksPageState} initialState | 24 * @param {!BookmarksPageState} initialState |
| 25 */ | 25 */ |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 }); | 73 }); |
| 74 }, | 74 }, |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 cr.addSingletonGetter(Store); | 77 cr.addSingletonGetter(Store); |
| 78 | 78 |
| 79 return { | 79 return { |
| 80 Store: Store, | 80 Store: Store, |
| 81 }; | 81 }; |
| 82 }); | 82 }); |
| OLD | NEW |