Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview A helper object to be used when an iron-list needs to be aware | |
| 7 * of a global scroll target. | |
| 8 */ | |
| 9 | |
| 10 /** | |
| 11 * Global object to hold the scroll target. | |
| 12 * @type {{scrollTarget: (HTMLElement|undefined)}} | |
| 13 */ | |
| 14 global.settingsScrollTargetData = {}; | |
| 15 | |
| 16 /** @polymerBehavior */ | |
| 17 var GlobalScrollTargetBehavior = { | |
| 18 properties: { | |
| 19 /** | |
| 20 * Read only property for the scroll target. | |
| 21 * @type {HTMLElement} | |
| 22 */ | |
| 23 scrollTarget: { | |
| 24 type: Object, | |
| 25 computed: 'getScrollTarget_(globalData_.scrollTarget)', | |
| 26 }, | |
| 27 | |
| 28 /** | |
| 29 * Reference to the global data. This allows Polymer style data binding. | |
| 30 * @type {{scrollTarget: (HTMLElement|undefined)}} | |
| 31 * @private | |
| 32 */ | |
| 33 globalData_: Object, | |
|
michaelpg
2016/10/18 21:58:00
i'd suggest:
globalData_: {
type: Object,
val
hcarmona
2016/10/19 18:53:34
Acknowledged.
| |
| 34 }, | |
| 35 | |
| 36 /** @override */ | |
| 37 ready: function() { | |
| 38 this.globalData_ = global.settingsScrollTargetData; | |
| 39 }, | |
| 40 | |
| 41 /** @param {HTMLElement} value */ | |
| 42 setGlobalScrollTarget: function(value) { | |
| 43 this.globalData_.scrollTarget = value; | |
|
michaelpg
2016/10/18 21:58:00
This doesn't actually propagate. It may work, but
hcarmona
2016/10/19 18:53:34
--------------------------------------------------
michaelpg
2016/10/19 19:50:08
No, but we should make that assumption explicit (w
hcarmona
2016/10/20 14:27:43
Done.
| |
| 44 }, | |
| 45 | |
| 46 /** | |
| 47 * @return {HTMLElement|undefined} | |
| 48 * @private | |
| 49 */ | |
| 50 getScrollTarget_: function() { | |
| 51 return this.globalData_.scrollTarget; | |
| 52 }, | |
| 53 }; | |
| OLD | NEW |