Skip to content

Commit 7de97e4

Browse files
saschanazsandersn
andauthored
Add Console types, take 2 (#831)
* add Console types * emit as an interface * remove re-added interface from bad merge Co-authored-by: Nathan Shively-Sanders <[email protected]>
1 parent 17d9039 commit 7de97e4

8 files changed

+133
-166
lines changed

baselines/dom.generated.d.ts

Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3587,40 +3587,6 @@ interface ConcatParams extends Algorithm {
35873587
publicInfo?: Uint8Array;
35883588
}
35893589

3590-
/** Provides access to the browser's debugging console (e.g. the Web Console in Firefox). The specifics of how it works varies from browser to browser, but there is a de facto set of features that are typically provided. */
3591-
interface Console {
3592-
memory: any;
3593-
assert(condition?: boolean, message?: string, ...data: any[]): void;
3594-
clear(): void;
3595-
count(label?: string): void;
3596-
debug(message?: any, ...optionalParams: any[]): void;
3597-
dir(value?: any, ...optionalParams: any[]): void;
3598-
dirxml(value: any): void;
3599-
error(message?: any, ...optionalParams: any[]): void;
3600-
exception(message?: string, ...optionalParams: any[]): void;
3601-
group(groupTitle?: string, ...optionalParams: any[]): void;
3602-
groupCollapsed(groupTitle?: string, ...optionalParams: any[]): void;
3603-
groupEnd(): void;
3604-
info(message?: any, ...optionalParams: any[]): void;
3605-
log(message?: any, ...optionalParams: any[]): void;
3606-
markTimeline(label?: string): void;
3607-
profile(reportName?: string): void;
3608-
profileEnd(reportName?: string): void;
3609-
table(...tabularData: any[]): void;
3610-
time(label?: string): void;
3611-
timeEnd(label?: string): void;
3612-
timeStamp(label?: string): void;
3613-
timeline(label?: string): void;
3614-
timelineEnd(label?: string): void;
3615-
trace(message?: any, ...optionalParams: any[]): void;
3616-
warn(message?: any, ...optionalParams: any[]): void;
3617-
}
3618-
3619-
declare var Console: {
3620-
prototype: Console;
3621-
new(): Console;
3622-
};
3623-
36243590
interface ConstantSourceNode extends AudioScheduledSourceNode {
36253591
readonly offset: AudioParam;
36263592
addEventListener<K extends keyof AudioScheduledSourceNodeEventMap>(type: K, listener: (this: ConstantSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@@ -18548,7 +18514,7 @@ interface WindowEventMap extends GlobalEventHandlersEventMap, WindowEventHandler
1854818514
}
1854918515

1855018516
/** A window containing a DOM document; the document property points to the DOM document loaded in that window. */
18551-
interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandlers, WindowConsole, WindowEventHandlers, WindowLocalStorage, WindowOrWorkerGlobalScope, WindowSessionStorage {
18517+
interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandlers, WindowEventHandlers, WindowLocalStorage, WindowOrWorkerGlobalScope, WindowSessionStorage {
1855218518
readonly applicationCache: ApplicationCache;
1855318519
readonly clientInformation: Navigator;
1855418520
readonly closed: boolean;
@@ -18678,10 +18644,6 @@ declare var Window: {
1867818644
new(): Window;
1867918645
};
1868018646

18681-
interface WindowConsole {
18682-
readonly console: Console;
18683-
}
18684-
1868518647
interface WindowEventHandlersEventMap {
1868618648
"afterprint": Event;
1868718649
"beforeprint": Event;
@@ -19092,6 +19054,33 @@ declare var webkitRTCPeerConnection: {
1909219054

1909319055
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
1909419056

19057+
interface Console {
19058+
memory: any;
19059+
assert(condition?: boolean, ...data: any[]): void;
19060+
clear(): void;
19061+
count(label?: string): void;
19062+
countReset(label?: string): void;
19063+
debug(...data: any[]): void;
19064+
dir(item?: any, options?: any): void;
19065+
dirxml(...data: any[]): void;
19066+
error(...data: any[]): void;
19067+
exception(message?: string, ...optionalParams: any[]): void;
19068+
group(...data: any[]): void;
19069+
groupCollapsed(...data: any[]): void;
19070+
groupEnd(): void;
19071+
info(...data: any[]): void;
19072+
log(...data: any[]): void;
19073+
table(tabularData?: any, properties?: string[]): void;
19074+
time(label?: string): void;
19075+
timeEnd(label?: string): void;
19076+
timeLog(label?: string, ...data: any[]): void;
19077+
timeStamp(label?: string): void;
19078+
trace(...data: any[]): void;
19079+
warn(...data: any[]): void;
19080+
}
19081+
19082+
declare var console: Console;
19083+
1909519084
/** Holds useful CSS-related methods. No object with this interface are implemented: it contains only static methods and therefore is a utilitarian interface. */
1909619085
declare namespace CSS {
1909719086
function escape(ident: string): string;
@@ -19669,7 +19658,6 @@ declare function toString(): string;
1966919658
declare function dispatchEvent(event: Event): boolean;
1967019659
declare var sessionStorage: Storage;
1967119660
declare var localStorage: Storage;
19672-
declare var console: Console;
1967319661
/**
1967419662
* Fires when the user aborts the download.
1967519663
* @param ev The event.

baselines/webworker.generated.d.ts

Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -933,40 +933,6 @@ interface ConcatParams extends Algorithm {
933933
publicInfo?: Uint8Array;
934934
}
935935

936-
/** Provides access to the browser's debugging console (e.g. the Web Console in Firefox). The specifics of how it works varies from browser to browser, but there is a de facto set of features that are typically provided. */
937-
interface Console {
938-
memory: any;
939-
assert(condition?: boolean, message?: string, ...data: any[]): void;
940-
clear(): void;
941-
count(label?: string): void;
942-
debug(message?: any, ...optionalParams: any[]): void;
943-
dir(value?: any, ...optionalParams: any[]): void;
944-
dirxml(value: any): void;
945-
error(message?: any, ...optionalParams: any[]): void;
946-
exception(message?: string, ...optionalParams: any[]): void;
947-
group(groupTitle?: string, ...optionalParams: any[]): void;
948-
groupCollapsed(groupTitle?: string, ...optionalParams: any[]): void;
949-
groupEnd(): void;
950-
info(message?: any, ...optionalParams: any[]): void;
951-
log(message?: any, ...optionalParams: any[]): void;
952-
markTimeline(label?: string): void;
953-
profile(reportName?: string): void;
954-
profileEnd(reportName?: string): void;
955-
table(...tabularData: any[]): void;
956-
time(label?: string): void;
957-
timeEnd(label?: string): void;
958-
timeStamp(label?: string): void;
959-
timeline(label?: string): void;
960-
timelineEnd(label?: string): void;
961-
trace(message?: any, ...optionalParams: any[]): void;
962-
warn(message?: any, ...optionalParams: any[]): void;
963-
}
964-
965-
declare var Console: {
966-
prototype: Console;
967-
new(): Console;
968-
};
969-
970936
/** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */
971937
interface CountQueuingStrategy extends QueuingStrategy {
972938
highWaterMark: number;
@@ -5410,10 +5376,6 @@ declare var WindowClient: {
54105376
new(): WindowClient;
54115377
};
54125378

5413-
interface WindowConsole {
5414-
readonly console: Console;
5415-
}
5416-
54175379
interface WindowOrWorkerGlobalScope {
54185380
readonly caches: CacheStorage;
54195381
readonly crypto: Crypto;
@@ -5472,7 +5434,7 @@ interface WorkerGlobalScopeEventMap {
54725434
}
54735435

54745436
/** This Web Workers API interface is an interface representing the scope of any worker. Workers have no browsing context; this scope contains the information usually conveyed by Window objects — in this case event handlers, the console or the associated WorkerNavigator object. Each WorkerGlobalScope has its own event loop. */
5475-
interface WorkerGlobalScope extends EventTarget, WindowConsole, WindowOrWorkerGlobalScope {
5437+
interface WorkerGlobalScope extends EventTarget, WindowOrWorkerGlobalScope {
54765438
/**
54775439
* Returns workerGlobal's WorkerLocation object.
54785440
*/
@@ -5714,6 +5676,33 @@ declare var XMLHttpRequestUpload: {
57145676

57155677
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
57165678

5679+
interface Console {
5680+
memory: any;
5681+
assert(condition?: boolean, ...data: any[]): void;
5682+
clear(): void;
5683+
count(label?: string): void;
5684+
countReset(label?: string): void;
5685+
debug(...data: any[]): void;
5686+
dir(item?: any, options?: any): void;
5687+
dirxml(...data: any[]): void;
5688+
error(...data: any[]): void;
5689+
exception(message?: string, ...optionalParams: any[]): void;
5690+
group(...data: any[]): void;
5691+
groupCollapsed(...data: any[]): void;
5692+
groupEnd(): void;
5693+
info(...data: any[]): void;
5694+
log(...data: any[]): void;
5695+
table(tabularData?: any, properties?: string[]): void;
5696+
time(label?: string): void;
5697+
timeEnd(label?: string): void;
5698+
timeLog(label?: string, ...data: any[]): void;
5699+
timeStamp(label?: string): void;
5700+
trace(...data: any[]): void;
5701+
warn(...data: any[]): void;
5702+
}
5703+
5704+
declare var console: Console;
5705+
57175706
declare namespace WebAssembly {
57185707
interface Global {
57195708
value: any;
@@ -5929,7 +5918,6 @@ declare function fetch(input: RequestInfo, init?: RequestInit): Promise<Response
59295918
declare function queueMicrotask(callback: VoidFunction): void;
59305919
declare function setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
59315920
declare function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
5932-
declare var console: Console;
59335921
declare function cancelAnimationFrame(handle: number): void;
59345922
declare function requestAnimationFrame(callback: FrameRequestCallback): number;
59355923
declare function addEventListener<K extends keyof DedicatedWorkerGlobalScopeEventMap>(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;

inputfiles/addedTypes.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3991,10 +3991,7 @@
39913991
"type": "PromiseRejectionEvent"
39923992
}
39933993
]
3994-
},
3995-
"implements": [
3996-
"WindowConsole"
3997-
]
3994+
}
39983995
},
39993996
"XMLDocument": {
40003997
"name": "XMLDocument",

inputfiles/idl/Console.widl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[Exposed=(Window,Worker,Worklet)]
2+
namespace console { // but see namespace object requirements below
3+
// Logging
4+
void assert(optional boolean condition = false, any... data);
5+
void clear();
6+
void debug(any... data);
7+
void error(any... data);
8+
void info(any... data);
9+
void log(any... data);
10+
void table(optional any tabularData, optional sequence<DOMString> properties);
11+
void trace(any... data);
12+
void warn(any... data);
13+
void dir(optional any item, optional object? options);
14+
void dirxml(any... data);
15+
16+
// Counting
17+
void count(optional DOMString label = "default");
18+
void countReset(optional DOMString label = "default");
19+
20+
// Grouping
21+
void group(any... data);
22+
void groupCollapsed(any... data);
23+
void groupEnd();
24+
25+
// Timing
26+
void time(optional DOMString label = "default");
27+
void timeLog(optional DOMString label = "default", any... data);
28+
void timeEnd(optional DOMString label = "default");
29+
};

inputfiles/idlSources.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
"title": "Compatibility",
1313
"deprecated": true
1414
},
15+
{
16+
"url": "https://console.spec.whatwg.org/",
17+
"title": "Console"
18+
},
1519
{
1620
"url": "https://www.w3.org/TR/credential-management-1/",
1721
"title": "Credential Management"

inputfiles/overridingTypes.json

Lines changed: 27 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -994,79 +994,6 @@
994994
}
995995
}
996996
},
997-
"Console": {
998-
"name": "Console",
999-
"methods": {
1000-
"method": {
1001-
"debug": {
1002-
"name": "debug",
1003-
"override-signatures": [
1004-
"debug(message?: any, ...optionalParams: any[]): void"
1005-
]
1006-
},
1007-
"dir": {
1008-
"name": "dir",
1009-
"override-signatures": [
1010-
"dir(value?: any, ...optionalParams: any[]): void"
1011-
]
1012-
},
1013-
"dirxml": {
1014-
"name": "dirxml",
1015-
"override-signatures": [
1016-
"dirxml(value: any): void"
1017-
]
1018-
},
1019-
"error": {
1020-
"name": "error",
1021-
"override-signatures": [
1022-
"error(message?: any, ...optionalParams: any[]): void"
1023-
]
1024-
},
1025-
"info": {
1026-
"name": "info",
1027-
"override-signatures": [
1028-
"info(message?: any, ...optionalParams: any[]): void"
1029-
]
1030-
},
1031-
"log": {
1032-
"name": "log",
1033-
"override-signatures": [
1034-
"log(message?: any, ...optionalParams: any[]): void"
1035-
]
1036-
},
1037-
"warn": {
1038-
"name": "warn",
1039-
"override-signatures": [
1040-
"warn(message?: any, ...optionalParams: any[]): void"
1041-
]
1042-
},
1043-
"group": {
1044-
"name": "group",
1045-
"override-signatures": [
1046-
"group(groupTitle?: string, ...optionalParams: any[]): void"
1047-
]
1048-
},
1049-
"groupCollapsed": {
1050-
"name": "groupCollapsed",
1051-
"override-signatures": [
1052-
"groupCollapsed(groupTitle?: string, ...optionalParams: any[]): void"
1053-
]
1054-
},
1055-
"trace": {
1056-
"name": "trace",
1057-
"override-signatures": [
1058-
"trace(message?: any, ...optionalParams: any[]): void"
1059-
]
1060-
},
1061-
"profileEnd": {
1062-
"name": "profileEnd",
1063-
"override-signatures": [
1064-
"profileEnd(reportName?: string): void"
1065-
]
1066-
}
1067-
}
1068-
}
1069-
},
1070997
"FormData": {
1071998
"name": "FormData",
1072999
"methods": {
@@ -3197,6 +3124,33 @@
31973124
]
31983125
},
31993126
"namespaces": [
3127+
{
3128+
"name": "console",
3129+
"methods": {
3130+
"method": {
3131+
"exception": {
3132+
"name": "exception",
3133+
"override-signatures": [
3134+
"exception(message?: string, ...optionalParams: any[]): void"
3135+
]
3136+
},
3137+
"timeStamp": {
3138+
"name": "timeStamp",
3139+
"override-signatures": [
3140+
"timeStamp(label?: string): void"
3141+
]
3142+
}
3143+
}
3144+
},
3145+
"properties": {
3146+
"property": {
3147+
"memory": {
3148+
"name": "memory",
3149+
"type": "any"
3150+
}
3151+
}
3152+
}
3153+
},
32003154
{
32013155
"name": "WebAssembly",
32023156
"methods": {

inputfiles/removedTypes.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,7 @@
8181
}
8282
},
8383
"ClipboardItem": null,
84-
"Console": {
85-
"methods": {
86-
"method": {
87-
"msIsIndependentlyComposed": null,
88-
"select": null
89-
}
90-
}
91-
},
84+
"Console": null,
9285
"CSS": null,
9386
"CSSMarginRule": null,
9487
"CSSRule": {
@@ -374,7 +367,8 @@
374367
"GlobalFetch",
375368
"IDBEnvironment",
376369
"WindowBase64",
377-
"WindowTimers"
370+
"WindowTimers",
371+
"WindowConsole"
378372
]
379373
},
380374
"XPathNSResolver": null

0 commit comments

Comments
 (0)