-
Notifications
You must be signed in to change notification settings - Fork 443
Add Console types #452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Console types #452
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3723,40 +3723,6 @@ interface ConcatParams extends Algorithm { | |
publicInfo?: Uint8Array; | ||
} | ||
|
||
/** 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. */ | ||
interface Console { | ||
memory: any; | ||
assert(condition?: boolean, message?: string, ...data: any[]): void; | ||
clear(): void; | ||
count(label?: string): void; | ||
debug(message?: any, ...optionalParams: any[]): void; | ||
dir(value?: any, ...optionalParams: any[]): void; | ||
dirxml(value: any): void; | ||
error(message?: any, ...optionalParams: any[]): void; | ||
exception(message?: string, ...optionalParams: any[]): void; | ||
group(groupTitle?: string, ...optionalParams: any[]): void; | ||
groupCollapsed(groupTitle?: string, ...optionalParams: any[]): void; | ||
groupEnd(): void; | ||
info(message?: any, ...optionalParams: any[]): void; | ||
log(message?: any, ...optionalParams: any[]): void; | ||
markTimeline(label?: string): void; | ||
profile(reportName?: string): void; | ||
profileEnd(reportName?: string): void; | ||
table(...tabularData: any[]): void; | ||
time(label?: string): void; | ||
timeEnd(label?: string): void; | ||
timeStamp(label?: string): void; | ||
timeline(label?: string): void; | ||
timelineEnd(label?: string): void; | ||
trace(message?: any, ...optionalParams: any[]): void; | ||
warn(message?: any, ...optionalParams: any[]): void; | ||
} | ||
|
||
declare var Console: { | ||
prototype: Console; | ||
new(): Console; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When was this valid, if ever? (At least, I tested it on V8 and didn't get anything; I don't have Firefox installed.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No IE11 somehow has it, though. |
||
}; | ||
|
||
interface ConstantSourceNode extends AudioScheduledSourceNode { | ||
readonly offset: AudioParam; | ||
addEventListener<K extends keyof AudioScheduledSourceNodeEventMap>(type: K, listener: (this: ConstantSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; | ||
|
@@ -18590,7 +18556,7 @@ interface WindowEventMap extends GlobalEventHandlersEventMap, WindowEventHandler | |
} | ||
|
||
/** A window containing a DOM document; the document property points to the DOM document loaded in that window. */ | ||
interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandlers, WindowConsole, WindowEventHandlers, WindowLocalStorage, WindowOrWorkerGlobalScope, WindowSessionStorage { | ||
interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandlers, WindowEventHandlers, WindowLocalStorage, WindowOrWorkerGlobalScope, WindowSessionStorage { | ||
readonly applicationCache: ApplicationCache; | ||
readonly clientInformation: Navigator; | ||
readonly closed: boolean; | ||
|
@@ -18721,10 +18687,6 @@ declare var Window: { | |
new(): Window; | ||
}; | ||
|
||
interface WindowConsole { | ||
readonly console: Console; | ||
} | ||
|
||
interface WindowEventHandlersEventMap { | ||
"afterprint": Event; | ||
"beforeprint": Event; | ||
|
@@ -19125,6 +19087,31 @@ declare var webkitRTCPeerConnection: { | |
|
||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; | ||
|
||
declare namespace console { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll re-test @mhegazy's question. Here's how I'll do it in case you want to try it yourself. $ git checkout console
$ npm test
$ cp baselines/* ~/ts/src/lib
$ cd ~/ts
$ gulp
$ cd ~/dtslint-runner
$ npm run build
$ node bin/index.js --localTs ~/ts/built/local You need clones of Typescript, dtslint-runner and DefinitelyTyped to make this work. |
||
var memory: any; | ||
function assert(condition?: boolean, ...data: any[]): void; | ||
function clear(): void; | ||
function count(label?: string): void; | ||
function countReset(label?: string): void; | ||
function debug(...data: any[]): void; | ||
function dir(item?: any, options?: any): void; | ||
function dirxml(...data: any[]): void; | ||
function error(...data: any[]): void; | ||
function exception(message?: string, ...optionalParams: any[]): void; | ||
function group(...data: any[]): void; | ||
function groupCollapsed(...data: any[]): void; | ||
function groupEnd(): void; | ||
function info(...data: any[]): void; | ||
function log(...data: any[]): void; | ||
function table(tabularData?: any, properties?: string[]): void; | ||
function time(label?: string): void; | ||
function timeEnd(label?: string): void; | ||
function timeLog(label?: string, ...data: any[]): void; | ||
function timeStamp(label?: string): void; | ||
function trace(...data: any[]): void; | ||
function warn(...data: any[]): void; | ||
} | ||
|
||
declare namespace WebAssembly { | ||
interface CompileError { | ||
} | ||
|
@@ -19706,7 +19693,6 @@ declare function toString(): string; | |
declare function dispatchEvent(event: Event): boolean; | ||
declare var sessionStorage: Storage; | ||
declare var localStorage: Storage; | ||
declare var console: Console; | ||
/** | ||
* Fires when the user aborts the download. | ||
* @param ev The event. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -924,40 +924,6 @@ interface ConcatParams extends Algorithm { | |
publicInfo?: Uint8Array; | ||
} | ||
|
||
/** 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. */ | ||
interface Console { | ||
memory: any; | ||
assert(condition?: boolean, message?: string, ...data: any[]): void; | ||
clear(): void; | ||
count(label?: string): void; | ||
debug(message?: any, ...optionalParams: any[]): void; | ||
dir(value?: any, ...optionalParams: any[]): void; | ||
dirxml(value: any): void; | ||
error(message?: any, ...optionalParams: any[]): void; | ||
exception(message?: string, ...optionalParams: any[]): void; | ||
group(groupTitle?: string, ...optionalParams: any[]): void; | ||
groupCollapsed(groupTitle?: string, ...optionalParams: any[]): void; | ||
groupEnd(): void; | ||
info(message?: any, ...optionalParams: any[]): void; | ||
log(message?: any, ...optionalParams: any[]): void; | ||
markTimeline(label?: string): void; | ||
profile(reportName?: string): void; | ||
profileEnd(reportName?: string): void; | ||
table(...tabularData: any[]): void; | ||
time(label?: string): void; | ||
timeEnd(label?: string): void; | ||
timeStamp(label?: string): void; | ||
timeline(label?: string): void; | ||
timelineEnd(label?: string): void; | ||
trace(message?: any, ...optionalParams: any[]): void; | ||
warn(message?: any, ...optionalParams: any[]): void; | ||
} | ||
|
||
declare var Console: { | ||
prototype: Console; | ||
new(): Console; | ||
}; | ||
|
||
/** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */ | ||
interface CountQueuingStrategy extends QueuingStrategy { | ||
highWaterMark: number; | ||
|
@@ -5361,10 +5327,6 @@ declare var WindowClient: { | |
new(): WindowClient; | ||
}; | ||
|
||
interface WindowConsole { | ||
readonly console: Console; | ||
} | ||
|
||
interface WindowOrWorkerGlobalScope { | ||
readonly caches: CacheStorage; | ||
readonly crypto: Crypto; | ||
|
@@ -5409,7 +5371,7 @@ interface WorkerGlobalScopeEventMap { | |
} | ||
|
||
/** 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. */ | ||
interface WorkerGlobalScope extends EventTarget, WindowConsole, WindowOrWorkerGlobalScope, WorkerUtils { | ||
interface WorkerGlobalScope extends EventTarget, WindowOrWorkerGlobalScope, WorkerUtils { | ||
readonly caches: CacheStorage; | ||
readonly isSecureContext: boolean; | ||
readonly location: WorkerLocation; | ||
|
@@ -5646,6 +5608,31 @@ declare var XMLHttpRequestUpload: { | |
|
||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; | ||
|
||
declare namespace console { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is going to be a breaking change. i will need to run the tests against definitelytyped. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My concern is that augmentation to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My quick search on DefinitelyTyped (with a search query There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
|
||
var memory: any; | ||
function assert(condition?: boolean, ...data: any[]): void; | ||
function clear(): void; | ||
function count(label?: string): void; | ||
function countReset(label?: string): void; | ||
function debug(...data: any[]): void; | ||
function dir(item?: any, options?: any): void; | ||
function dirxml(...data: any[]): void; | ||
function error(...data: any[]): void; | ||
function exception(message?: string, ...optionalParams: any[]): void; | ||
function group(...data: any[]): void; | ||
function groupCollapsed(...data: any[]): void; | ||
function groupEnd(): void; | ||
function info(...data: any[]): void; | ||
function log(...data: any[]): void; | ||
function table(tabularData?: any, properties?: string[]): void; | ||
function time(label?: string): void; | ||
function timeEnd(label?: string): void; | ||
function timeLog(label?: string, ...data: any[]): void; | ||
function timeStamp(label?: string): void; | ||
function trace(...data: any[]): void; | ||
function warn(...data: any[]): void; | ||
} | ||
|
||
declare namespace WebAssembly { | ||
interface Global { | ||
value: any; | ||
|
@@ -5828,7 +5815,6 @@ declare var navigator: WorkerNavigator; | |
declare function importScripts(...urls: string[]): void; | ||
declare function atob(encodedString: string): string; | ||
declare function btoa(rawString: string): string; | ||
declare var console: Console; | ||
declare var caches: CacheStorage; | ||
declare var crypto: Crypto; | ||
declare var indexedDB: IDBFactory; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[Exposed=(Window,Worker,Worklet)] | ||
namespace console { // but see namespace object requirements below | ||
// Logging | ||
void assert(optional boolean condition = false, any... data); | ||
void clear(); | ||
void debug(any... data); | ||
void error(any... data); | ||
void info(any... data); | ||
void log(any... data); | ||
void table(optional any tabularData, optional sequence<DOMString> properties); | ||
void trace(any... data); | ||
void warn(any... data); | ||
void dir(optional any item, optional object? options); | ||
void dirxml(any... data); | ||
|
||
// Counting | ||
void count(optional DOMString label = "default"); | ||
void countReset(optional DOMString label = "default"); | ||
|
||
// Grouping | ||
void group(any... data); | ||
void groupCollapsed(any... data); | ||
void groupEnd(); | ||
|
||
// Timing | ||
void time(optional DOMString label = "default"); | ||
void timeLog(optional DOMString label = "default", any... data); | ||
void timeEnd(optional DOMString label = "default"); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following properties are now gone:
Do you know who this is likely to break? People with dependencies on old versions of IE? Somebody else?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that I have to keep
.memory
and.exception
for now because they are in Edge and Firefox although not in spec..markTimeline
is only in Edge (and not in IE11) in non-functional state.