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

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: Address comments 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') | no next file with comments »
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)
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 // duration = 0 is a valid input for "keep open indefinitely".
35 this.$.toast.duration = (e.detail.duration === undefined ? 10000 : e.d etail.duration)
31 this.$.toast.show(); 36 this.$.toast.show();
32 } else { 37 } else {
33 console.log("Empty message?", e); 38 console.log("Empty message?", e);
34 } 39 }
35 }.bind(this)); 40 }.bind(this));
36 }, 41 },
37 }); 42 });
38 </script> 43 </script>
OLDNEW
« no previous file with comments | « no previous file | res/js/common.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698