Skip to content

add URL typing to webworker #223

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

Merged
merged 4 commits into from
Mar 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13232,6 +13232,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
readonly top: Window;
readonly window: Window;
URL: typeof URL;
URLSearchParams: typeof URLSearchParams;
Blob: typeof Blob;
customElements: CustomElementRegistry;
alert(message?: any): void;
Expand Down
62 changes: 62 additions & 0 deletions baselines/webworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ interface NotificationOptions {
icon?: string;
}

interface ObjectURLOptions {
oneTimeOnly?: boolean;
}

interface PushSubscriptionOptionsInit {
userVisibleOnly?: boolean;
applicationServerKey?: any;
Expand Down Expand Up @@ -1008,6 +1012,29 @@ declare var SyncManager: {
new(): SyncManager;
}

interface URL {
hash: string;
host: string;
hostname: string;
href: string;
readonly origin: string;
password: string;
pathname: string;
port: string;
protocol: string;
search: string;
username: string;
readonly searchParams: URLSearchParams;
toString(): string;
}

declare var URL: {
prototype: URL;
new(url: string, base?: string): URL;
createObjectURL(object: any, options?: ObjectURLOptions): string;
revokeObjectURL(url: string): void;
}

interface WebSocketEventMap {
"close": CloseEvent;
"error": Event;
Expand Down Expand Up @@ -1484,6 +1511,41 @@ interface ImageBitmap {
close(): void;
}

interface URLSearchParams {
/**
* Appends a specified key/value pair as a new search parameter.
*/
append(name: string, value: string): void;
/**
* Deletes the given search parameter, and its associated value, from the list of all search parameters.
*/
delete(name: string): void;
/**
* Returns the first value associated to the given search parameter.
*/
get(name: string): string | null;
/**
* Returns all the values association with a given search parameter.
*/
getAll(name: string): string[];
/**
* Returns a Boolean indicating if such a search parameter exists.
*/
has(name: string): boolean;
/**
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
*/
set(name: string, value: string): void;
}

declare var URLSearchParams: {
prototype: URLSearchParams;
/**
* Constructor returning a URLSearchParams object.
*/
new (init?: string | URLSearchParams): URLSearchParams;
}

interface BlobPropertyBag {
type?: string;
endings?: string;
Expand Down
8 changes: 7 additions & 1 deletion inputfiles/addedTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@
{
"kind": "interface",
"name": "URLSearchParams",
"flavor": "Web",
"constructorSignatures": [
"new (init?: string | URLSearchParams): URLSearchParams"
],
Expand Down Expand Up @@ -226,6 +225,13 @@
"name": "URL",
"type": "typeof URL"
},
{
"kind": "property",
"interface": "Window",
"exposeGlobally": false,
"name": "URLSearchParams",
"type": "typeof URLSearchParams"
},
{
"kind": "property",
"interface": "Window",
Expand Down
5 changes: 4 additions & 1 deletion inputfiles/knownWorkerInterfaces.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"NotificationEventInit",
"NotificationOptions",
"NotificationPermissionCallback",
"ObjectURLOptions",
"Performance",
"PerformanceNavigation",
"PerformanceTiming",
Expand All @@ -91,11 +92,13 @@
"SyncEventInit",
"SyncManager",
"USVString",
"URL",
"URLSearchParams",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like you need ObjectURLOptions as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

"WebSocket",
"WindowBase64",
"WindowConsole",
"Worker",
"XMLHttpRequest",
"XMLHttpRequestEventTarget",
"XMLHttpRequestUpload"
]
]