void/extensions/ipynb/src/notebookSerializerWorker.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
780 B
TypeScript
Raw Permalink Normal View History

2024-09-24 04:46:08 +00:00
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { parentPort } from 'worker_threads';
import { serializeNotebookToString } from './serializers';
import type { NotebookData } from 'vscode';
if (parentPort) {
parentPort.on('message', ({ id, data }: { id: string; data: NotebookData }) => {
if (parentPort) {
const json = serializeNotebookToString(data);
const bytes = new TextEncoder().encode(json);
parentPort.postMessage({ id, data: bytes });
}
});
}