Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: res/imp/error-toast-sk.html

Issue 2309423004: Give error-toast a duration argument (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | res/js/common.js » ('j') | res/js/common.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!-- The <error-toast-sk> custom element declaration. 1 <!-- The <error-toast-sk> custom element declaration.
2 2
3 Listens for 'error-sk' events that bubble up to the document 3 Listens for 'error-sk' events that bubble up to the document
4 and displays them. 4 and displays them.
5 5
6 The 'error-sk' event should have 'detail' of the form: 6 The 'error-sk' event should have 'detail' of the form:
7 7
8 { 8 {
9 message: "The error message to display goes here.", 9 message: "The error message to display goes here.",
10 duration: Integer, the number of ms to display or 0 for indefinitely
11 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.
10 } 12 }
11 13
12 Attributes: 14 Attributes:
13 Events: 15 Events:
14 Methods: 16 Methods:
15 --> 17 -->
16 <link rel="import" href="/res/imp/bower_components/paper-toast/paper-toast.html" /> 18 <link rel="import" href="/res/imp/bower_components/paper-toast/paper-toast.html" />
17 19
18 <dom-module id="error-toast-sk"> 20 <dom-module id="error-toast-sk">
19 <template> 21 <template>
20 <paper-toast id=toast duration=10000></paper-toast> 22 <paper-toast id=toast></paper-toast>
21 </template> 23 </template>
22 </dom-module> 24 </dom-module>
23 25
24 <script> 26 <script>
25 Polymer({ 27 Polymer({
26 is: "error-toast-sk", 28 is: "error-toast-sk",
27 ready: function() { 29 ready: function() {
28 document.addEventListener('error-sk', function(e) { 30 document.addEventListener('error-sk', function(e) {
31 this.$.toast.close();
29 if (e.detail.message) { 32 if (e.detail.message) {
30 this.$.toast.text = e.detail.message; 33 this.$.toast.text = e.detail.message;
34 var duration = 10000;
35 // duration = 0 is a valid input for "keep open indefinitely".
36 if (e.detail.duration !== undefined) {
37 duration = e.detail.duration;
38 }
39 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.
31 this.$.toast.show(); 40 this.$.toast.show();
32 } else { 41 } else {
33 console.log("Empty message?", e); 42 console.log("Empty message?", e);
34 } 43 }
35 }.bind(this)); 44 }.bind(this));
36 }, 45 },
37 }); 46 });
38 </script> 47 </script>
OLDNEW
« no previous file with comments | « no previous file | res/js/common.js » ('j') | res/js/common.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698