Skip to content

Commit

Permalink
try fixes for v2
Browse files Browse the repository at this point in the history
  • Loading branch information
jtpio committed Jul 29, 2024
1 parent 8d0351c commit 2a55e77
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
18 changes: 12 additions & 6 deletions src/web_worker_kernel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
// Copyright (c) JupyterLite Contributors
// Distributed under the terms of the Modified BSD License.

import coincident from 'coincident';
// @ts-expect-error - no types available
import coincident from 'coincident/main';

const { Worker: CoincidentWorker } = coincident();

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

const worker = new CoincidentWorker(
new URL('./worker.js', import.meta.url),
{
type: 'module'
}
);
this._worker = worker;
this._remote = worker.proxy;
this._worker.onmessage = this._processWorkerMessage.bind(this);

this._remote = coincident(this._worker) as IXeusKernel;

this.setupFilesystemAPIs();

this._remote.initialize(this._kernelspec, PageConfig.getBaseUrl());
Expand Down
5 changes: 3 additions & 2 deletions src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// Copyright (c) JupyterLite Contributors
// Distributed under the terms of the Modified BSD License.

import coincident from 'coincident';
// @ts-expect-error - no types available
import coincident from 'coincident/worker';

import {
ContentsAPI,
Expand All @@ -19,7 +20,7 @@ declare function createXeusModule(options: any): any;

globalThis.Module = {};

const workerAPI = coincident(self) as typeof globalThis;
const { proxy: workerAPI } = await coincident();

/**
* An Emscripten-compatible synchronous Contents API using shared array buffers.
Expand Down

0 comments on commit 2a55e77

Please sign in to comment.