OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 * @polymerBehavior Tracks the initialization of a specified preference and | 6 * @polymerBehavior Tracks the initialization of a specified preference and |
7 * logs an error if the pref is not defined after prefs have been fetched. | 7 * logs an error if the pref is not defined after prefs have been fetched. |
8 */ | 8 */ |
9 var PrefControlBehavior = { | 9 var PrefControlBehavior = { |
10 properties: { | 10 properties: { |
(...skipping 11 matching lines...) Expand all Loading... |
22 /** @override */ | 22 /** @override */ |
23 ready: function() { | 23 ready: function() { |
24 this.validatePref_(); | 24 this.validatePref_(); |
25 }, | 25 }, |
26 | 26 |
27 /** | 27 /** |
28 * Logs an error once prefs are initialized if the tracked pref is not found. | 28 * Logs an error once prefs are initialized if the tracked pref is not found. |
29 * @private | 29 * @private |
30 */ | 30 */ |
31 validatePref_: function() { | 31 validatePref_: function() { |
32 CrSettingsPrefs.initialized.then(function() { | 32 CrSettingsPrefs.initialized.then(() => { |
33 if (!this.pref) { | 33 if (!this.pref) { |
34 var error = 'Pref not found for element ' + this.tagName; | 34 var error = 'Pref not found for element ' + this.tagName; |
35 if (this.id) | 35 if (this.id) |
36 error += '#' + this.id; | 36 error += '#' + this.id; |
37 error += ' in ' + this.domHost.tagName; | 37 error += ' in ' + this.domHost.tagName; |
38 console.error(error); | 38 console.error(error); |
39 } | 39 } |
40 }.bind(this)); | 40 }); |
41 }, | 41 }, |
42 }; | 42 }; |
OLD | NEW |