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

Side by Side Diff: res/js/common.js

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
« res/imp/error-toast-sk.html ('K') | « res/imp/error-toast-sk.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /** 1 /**
2 * common.js is a set of common functions used across all of skiaperf. 2 * common.js is a set of common functions used across all of skiaperf.
3 * 3 *
4 * Everything is scoped to 'sk' except $$ and $$$ which are global since they 4 * Everything is scoped to 'sk' except $$ and $$$ which are global since they
5 * are used so often. 5 * are used so often.
6 * 6 *
7 */ 7 */
8 8
9 /** 9 /**
10 * $$ returns a real JS array of DOM elements that match the CSS query selector. 10 * $$ returns a real JS array of DOM elements that match the CSS query selector.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 return null; 64 return null;
65 } 65 }
66 66
67 /** 67 /**
68 * errorMessage dispatches an event with the error message in it. 68 * errorMessage dispatches an event with the error message in it.
69 * 69 *
70 * See <error-toast-sk> for an element that listens for such events 70 * See <error-toast-sk> for an element that listens for such events
71 * and displays the error messages. 71 * and displays the error messages.
72 * 72 *
73 */ 73 */
74 sk.errorMessage = function(message) { 74 sk.errorMessage = function(message, duration) {
75 var detail = { 75 var detail = {
76 message: message, 76 message: message,
77 } 77 }
78 if (duration !== undefined) {
79 detail.duration = duration;
jcgregorio 2016/09/06 20:37:01 Just use: detail.duration = duration; Since un
kjlubick 2016/09/06 20:39:37 Done.
80 }
78 document.dispatchEvent(new CustomEvent('error-sk', {detail: detail, bubbles: true})); 81 document.dispatchEvent(new CustomEvent('error-sk', {detail: detail, bubbles: true}));
79 } 82 }
80 83
81 /** 84 /**
82 * Importer simplifies importing HTML Templates from HTML Imports. 85 * Importer simplifies importing HTML Templates from HTML Imports.
83 * 86 *
84 * Just instantiate an instance in the HTML Import: 87 * Just instantiate an instance in the HTML Import:
85 * 88 *
86 * importer = new sk.Importer(); 89 * importer = new sk.Importer();
87 * 90 *
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 // returns true iff the string starts with the given prefix 830 // returns true iff the string starts with the given prefix
828 if (!String.prototype.startsWith) { 831 if (!String.prototype.startsWith) {
829 String.prototype.startsWith = function(searchString, position) { 832 String.prototype.startsWith = function(searchString, position) {
830 position = position || 0; 833 position = position || 0;
831 return this.indexOf(searchString, position) === position; 834 return this.indexOf(searchString, position) === position;
832 }; 835 };
833 } 836 }
834 837
835 return sk; 838 return sk;
836 }(); 839 }();
OLDNEW
« res/imp/error-toast-sk.html ('K') | « res/imp/error-toast-sk.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698