Skip to content

Commit cac1198

Browse files
authored
Merge pull request #223 from VincentBel/webworker-add-URL
add URL typing to webworker
2 parents 56a53e1 + 0fe9b6f commit cac1198

File tree

4 files changed

+74
-2
lines changed

4 files changed

+74
-2
lines changed

baselines/dom.generated.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13237,6 +13237,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
1323713237
readonly top: Window;
1323813238
readonly window: Window;
1323913239
URL: typeof URL;
13240+
URLSearchParams: typeof URLSearchParams;
1324013241
Blob: typeof Blob;
1324113242
customElements: CustomElementRegistry;
1324213243
alert(message?: any): void;

baselines/webworker.generated.d.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ interface NotificationOptions {
6161
icon?: string;
6262
}
6363

64+
interface ObjectURLOptions {
65+
oneTimeOnly?: boolean;
66+
}
67+
6468
interface PushSubscriptionOptionsInit {
6569
userVisibleOnly?: boolean;
6670
applicationServerKey?: any;
@@ -1008,6 +1012,29 @@ declare var SyncManager: {
10081012
new(): SyncManager;
10091013
}
10101014

1015+
interface URL {
1016+
hash: string;
1017+
host: string;
1018+
hostname: string;
1019+
href: string;
1020+
readonly origin: string;
1021+
password: string;
1022+
pathname: string;
1023+
port: string;
1024+
protocol: string;
1025+
search: string;
1026+
username: string;
1027+
readonly searchParams: URLSearchParams;
1028+
toString(): string;
1029+
}
1030+
1031+
declare var URL: {
1032+
prototype: URL;
1033+
new(url: string, base?: string): URL;
1034+
createObjectURL(object: any, options?: ObjectURLOptions): string;
1035+
revokeObjectURL(url: string): void;
1036+
}
1037+
10111038
interface WebSocketEventMap {
10121039
"close": CloseEvent;
10131040
"error": Event;
@@ -1484,6 +1511,41 @@ interface ImageBitmap {
14841511
close(): void;
14851512
}
14861513

1514+
interface URLSearchParams {
1515+
/**
1516+
* Appends a specified key/value pair as a new search parameter.
1517+
*/
1518+
append(name: string, value: string): void;
1519+
/**
1520+
* Deletes the given search parameter, and its associated value, from the list of all search parameters.
1521+
*/
1522+
delete(name: string): void;
1523+
/**
1524+
* Returns the first value associated to the given search parameter.
1525+
*/
1526+
get(name: string): string | null;
1527+
/**
1528+
* Returns all the values association with a given search parameter.
1529+
*/
1530+
getAll(name: string): string[];
1531+
/**
1532+
* Returns a Boolean indicating if such a search parameter exists.
1533+
*/
1534+
has(name: string): boolean;
1535+
/**
1536+
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
1537+
*/
1538+
set(name: string, value: string): void;
1539+
}
1540+
1541+
declare var URLSearchParams: {
1542+
prototype: URLSearchParams;
1543+
/**
1544+
* Constructor returning a URLSearchParams object.
1545+
*/
1546+
new (init?: string | URLSearchParams): URLSearchParams;
1547+
}
1548+
14871549
interface BlobPropertyBag {
14881550
type?: string;
14891551
endings?: string;

inputfiles/addedTypes.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@
181181
{
182182
"kind": "interface",
183183
"name": "URLSearchParams",
184-
"flavor": "Web",
185184
"constructorSignatures": [
186185
"new (init?: string | URLSearchParams): URLSearchParams"
187186
],
@@ -226,6 +225,13 @@
226225
"name": "URL",
227226
"type": "typeof URL"
228227
},
228+
{
229+
"kind": "property",
230+
"interface": "Window",
231+
"exposeGlobally": false,
232+
"name": "URLSearchParams",
233+
"type": "typeof URLSearchParams"
234+
},
229235
{
230236
"kind": "property",
231237
"interface": "Window",

inputfiles/knownWorkerInterfaces.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"NotificationEventInit",
6767
"NotificationOptions",
6868
"NotificationPermissionCallback",
69+
"ObjectURLOptions",
6970
"Performance",
7071
"PerformanceNavigation",
7172
"PerformanceTiming",
@@ -91,11 +92,13 @@
9192
"SyncEventInit",
9293
"SyncManager",
9394
"USVString",
95+
"URL",
96+
"URLSearchParams",
9497
"WebSocket",
9598
"WindowBase64",
9699
"WindowConsole",
97100
"Worker",
98101
"XMLHttpRequest",
99102
"XMLHttpRequestEventTarget",
100103
"XMLHttpRequestUpload"
101-
]
104+
]

0 commit comments

Comments
 (0)