Chromium Code Reviews| Index: res/imp/error-toast-sk.html |
| diff --git a/res/imp/error-toast-sk.html b/res/imp/error-toast-sk.html |
| index e3684177085db32ed2dc2b120d1d41da34ba34e1..fbb197e1ade4ae1005a08e205b738662bd27c02e 100644 |
| --- a/res/imp/error-toast-sk.html |
| +++ b/res/imp/error-toast-sk.html |
| @@ -7,6 +7,8 @@ |
| { |
| message: "The error message to display goes here.", |
| + duration: Integer, the number of ms to display or 0 for indefinitely |
| + defaults to 10000 (10s) |
|
jcgregorio
2016/09/06 20:37:01
Integer, the number of ms to display or 0 for inde
kjlubick
2016/09/06 20:39:37
Done.
|
| } |
| Attributes: |
| @@ -17,7 +19,7 @@ |
| <dom-module id="error-toast-sk"> |
| <template> |
| - <paper-toast id=toast duration=10000></paper-toast> |
| + <paper-toast id=toast></paper-toast> |
| </template> |
| </dom-module> |
| @@ -26,8 +28,15 @@ |
| is: "error-toast-sk", |
| ready: function() { |
| document.addEventListener('error-sk', function(e) { |
| + this.$.toast.close(); |
| if (e.detail.message) { |
| this.$.toast.text = e.detail.message; |
| + var duration = 10000; |
| + // duration = 0 is a valid input for "keep open indefinitely". |
| + if (e.detail.duration !== undefined) { |
| + duration = e.detail.duration; |
| + } |
| + this.$.toast.duration = duration; |
|
jcgregorio
2016/09/06 20:37:01
this.$.toast.duration = (e.detail.duration === und
kjlubick
2016/09/06 20:39:37
Done.
|
| this.$.toast.show(); |
| } else { |
| console.log("Empty message?", e); |