Chromium Code Reviews| Index: chrome/browser/resources/md_bookmarks/toast.js |
| diff --git a/chrome/browser/resources/md_bookmarks/toast.js b/chrome/browser/resources/md_bookmarks/toast.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..fe85ef762cd5b3bba6eab38a2d8c739f547c630e |
| --- /dev/null |
| +++ b/chrome/browser/resources/md_bookmarks/toast.js |
| @@ -0,0 +1,28 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +Polymer({ |
| + is: 'bookmarks-toast', |
| + |
| + properties: { |
| + open: { |
| + type: Boolean, |
| + reflectToAttribute: true, |
| + observer: 'openChanged_', |
| + }, |
| + |
| + // Leaving duration undefined or set to 0 will make the toast show forever. |
| + 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.
|
| + }, |
| + |
| + /** @private */ |
| + openChanged_: function() { |
| + if (!this.open || !this.duration) |
| + return; |
| + |
| + 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.
|
| + this.open = false; |
| + }.bind(this), this.duration); |
| + }, |
| +}); |