Skip to content

Commit c1bba53

Browse files
committed
try fixes for v2
1 parent f4e7994 commit c1bba53

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

Diff for: src/web_worker_kernel.ts

+12-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
// Copyright (c) JupyterLite Contributors
33
// Distributed under the terms of the Modified BSD License.
44

5-
import coincident from 'coincident';
5+
// @ts-expect-error - no types available
6+
import coincident from 'coincident/main';
7+
8+
const { Worker: CoincidentWorker } = coincident();
69

710
import { ISignal, Signal } from '@lumino/signaling';
811
import { PromiseDelegate } from '@lumino/coreutils';
@@ -48,14 +51,17 @@ export class WebWorkerKernel implements IKernel {
4851
this._kernelspec = kernelspec;
4952
this._contentsManager = contentsManager;
5053
this._sendMessage = sendMessage;
51-
this._worker = new Worker(new URL('./worker.js', import.meta.url), {
52-
type: 'module'
53-
});
5454

55+
const worker = new CoincidentWorker(
56+
new URL('./worker.js', import.meta.url),
57+
{
58+
type: 'module'
59+
}
60+
);
61+
this._worker = worker;
62+
this._remote = worker.proxy;
5563
this._worker.onmessage = this._processWorkerMessage.bind(this);
5664

57-
this._remote = coincident(this._worker) as IXeusKernel;
58-
5965
this.setupFilesystemAPIs();
6066

6167
this._remote.initialize(this._kernelspec, PageConfig.getBaseUrl());

Diff for: src/worker.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// Copyright (c) JupyterLite Contributors
33
// Distributed under the terms of the Modified BSD License.
44

5-
import coincident from 'coincident';
5+
// @ts-expect-error - no types available
6+
import coincident from 'coincident/worker';
67

78
import {
89
ContentsAPI,
@@ -19,7 +20,7 @@ declare function createXeusModule(options: any): any;
1920

2021
globalThis.Module = {};
2122

22-
const workerAPI = coincident(self) as typeof globalThis;
23+
const { proxy: workerAPI } = await coincident();
2324

2425
/**
2526
* An Emscripten-compatible synchronous Contents API using shared array buffers.

0 commit comments

Comments
 (0)