OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 Polymer({ | |
6 is: 'bookmarks-toast', | |
7 | |
8 properties: { | |
9 open: { | |
10 type: Boolean, | |
11 reflectToAttribute: true, | |
12 observer: 'openChanged_', | |
13 }, | |
14 | |
15 // Leaving duration undefined or set to 0 will make the toast show forever. | |
16 duration: Number, | |
dpapad
2017/06/01 17:35:44
Nit: Can we give this an initial value of 0? This
calamity
2017/06/02 05:34:22
Done.
| |
17 }, | |
18 | |
19 /** @private */ | |
20 openChanged_: function() { | |
21 if (!this.open || !this.duration) | |
22 return; | |
23 | |
24 setTimeout(function() { | |
dpapad
2017/06/01 17:35:44
Shouldn't we be canceling this timeout to avoid ra
calamity
2017/06/02 05:34:22
Good catch!
Done.
| |
25 this.open = false; | |
26 }.bind(this), this.duration); | |
27 }, | |
28 }); | |
OLD | NEW |