Chromium Code Reviews| 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 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 * getter function returns |undefined|, no changes will propagate to the UI. | 42 * getter function returns |undefined|, no changes will propagate to the UI. |
| 43 * | 43 * |
| 44 * Typechecking is supressed because this conflicts with | 44 * Typechecking is supressed because this conflicts with |
| 45 * Object.prototype.watch, which is a Gecko-only method that is recognized | 45 * Object.prototype.watch, which is a Gecko-only method that is recognized |
| 46 * by Closure. | 46 * by Closure. |
| 47 * @suppress {checkTypes} | 47 * @suppress {checkTypes} |
| 48 * @param {string} localProperty | 48 * @param {string} localProperty |
| 49 * @param {function(!BookmarksPageState)} valueGetter | 49 * @param {function(!BookmarksPageState)} valueGetter |
| 50 */ | 50 */ |
| 51 watch: function(localProperty, valueGetter) { | 51 watch: function(localProperty, valueGetter) { |
| 52 // TODO(tsergeant): Warn if localProperty is not a defined property. | 52 if (!this.getPropertyInfo(localProperty).defined) { |
|
tsergeant
2017/05/02 05:09:10
I originally TODO'd this because I thought it woul
calamity
2017/05/02 05:35:59
Heh.
Polymer 2.0:
Removed APIs
- element.getPrope
tsergeant
2017/05/02 05:41:56
😔
| |
| 53 console.error( | |
| 54 'No property ' + localProperty + ' defined on ' + this.is); | |
| 55 } | |
| 53 this.watches_.push({ | 56 this.watches_.push({ |
| 54 localProperty: localProperty, | 57 localProperty: localProperty, |
| 55 valueGetter: valueGetter, | 58 valueGetter: valueGetter, |
| 56 }); | 59 }); |
| 57 }, | 60 }, |
| 58 | 61 |
| 59 /** | 62 /** |
| 60 * Helper to dispatch an action to the store, which will update the store | 63 * Helper to dispatch an action to the store, which will update the store |
| 61 * data and then (possibly) flow through to the UI. | 64 * data and then (possibly) flow through to the UI. |
| 62 * @param {Action} action | 65 * @param {Action} action |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 89 /** @return {!BookmarksPageState} */ | 92 /** @return {!BookmarksPageState} */ |
| 90 getState: function() { | 93 getState: function() { |
| 91 return bookmarks.Store.getInstance().data; | 94 return bookmarks.Store.getInstance().data; |
| 92 }, | 95 }, |
| 93 }; | 96 }; |
| 94 | 97 |
| 95 return { | 98 return { |
| 96 StoreClient: StoreClient, | 99 StoreClient: StoreClient, |
| 97 }; | 100 }; |
| 98 }); | 101 }); |
| OLD | NEW |