diff --git a/index.bs b/index.bs index ed89c77..e3c1494 100644 --- a/index.bs +++ b/index.bs @@ -68,6 +68,7 @@ namespace console { // but see namespace object requirements below // Timing void time(optional DOMString label = "default"); + void timeLog(optional DOMString label = "default", any... data); void timeEnd(optional DOMString label = "default"); }; @@ -78,8 +79,7 @@ namespace console { // but see namespace object requirements below
It is important that {{console}} is always visible and usable to scripts, even if the developer - console has not been opened or - does not exist. + console has not been opened or does not exist.
For historical web-compatibility reasons, the namespace object for {{console}} must have as @@ -234,16 +234,49 @@ Each {{console}} namespace object has an associated timer table, whic 1. Otherwise, [=map/set=] the value of the entry with key |label| in the associated timer table to the current time. -"4650", "4650.69 ms", "5 seconds", and "00:05" are all reasonable ways of displaying a 4650.69 ms duration.
1. Let |concat| be the concatenation of |label|, U+003A (:), U+0020 SPACE, and |duration|. -1. Perform Logger("timeEnd", « |concat| »). +1. [=list/prepend|Prepend=] |concat| to |data|. +1. Perform Printer("timeLog", data). + +
+ console.time("MyTimer");
+ console.timeLog("MyTimer", "Starting application up…");
+ // Perhaps some code runs to boostrap a complex app
+ // ...
+ console.timeLog("MyTimer", "UI is setup, making API calls now");
+ // Perhaps some fetch()'s here filling the app with data
+ // ...
+ console.timeEnd("MyTimer");
+
+See whatwg/console#134 +for plans to make {{console/timeEnd()}} and {{console/timeLog()}} formally report warnings to the +console when a given |label| does not exist in the associated timer table. +