Skip to content

Commit 2ba00a9

Browse files
author
webbureaucrat
committed
reproduce issue generating SharedWorker.
1 parent e18fa12 commit 2ba00a9

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

tools/TypeScript-DOM-lib-generator/src/build.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -320,12 +320,12 @@ async function emitDom() {
320320
// outputFolder,
321321
// useIteratorObject,
322322
// });
323-
// emitFlavor(webidl, new Set(knownTypes.Worker), {
324-
// name: "sharedworker",
325-
// global: ["SharedWorker", "Worker"],
326-
// outputFolder,
327-
// useIteratorObject,
328-
// });
323+
emitFlavor(webidl, new Set(knownTypes.Worker), {
324+
name: "sharedworker",
325+
global: ["SharedWorker", "Worker"],
326+
outputFolder,
327+
useIteratorObject,
328+
});
329329
// emitFlavor(webidl, new Set(knownTypes.Worker), {
330330
// name: "serviceworker",
331331
// global: ["ServiceWorker", "Worker"],

tools/TypeScript-DOM-lib-generator/src/build/emitter.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,7 @@ export async function emitRescriptBindings(webidl: Browser.WebIdl) {
15671567
}
15681568
printer.endLine();
15691569

1570-
const windowInterface = allInterfaces.find((i) => i.name === "Window");
1570+
const windowInterface = allInterfaces.find((i) => i.name === "WindowOrWorkerGlobalScope");
15711571
if (!windowInterface) throw new Error("Window interface not found");
15721572

15731573
const allProperties: Browser.Property[] =
@@ -2823,11 +2823,12 @@ export async function emitRescriptBindings(webidl: Browser.WebIdl) {
28232823
interfaceHierarchy = [
28242824
{
28252825
name: "Temp",
2826-
entries: [
2827-
enums(["WebGLPowerPreference"]),
2828-
dictionaries(["ImageBitmapRenderingContextSettings", "WebGLContextAttributes"]),
2826+
entries: [
2827+
enums(["WorkerType"]),
2828+
individualInterfaces(["SharedWorker"]),
2829+
dictionaries(["WorkerOptions"])
28292830
],
2830-
opens: [],
2831+
opens: [ "EventAPI", "ChannelMessagingAPI"],
28312832
}
28322833
]
28332834

@@ -2938,5 +2939,10 @@ export async function emitRescriptBindings(webidl: Browser.WebIdl) {
29382939
// emitIndividualInterfaces(remainers);
29392940
}
29402941

2941-
await emit();
2942+
await emit();
2943+
2944+
await fs.writeFile(
2945+
path.join(outputFolder, "sharedworker.json"),
2946+
JSON.stringify(webidl, null, 2),
2947+
);
29422948
}

0 commit comments

Comments
 (0)