Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 }(); |
| OLD | NEW |