mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-21 18:28:50 +00:00
20 lines
780 B
TypeScript
20 lines
780 B
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* 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 });
|
|
}
|
|
});
|
|
}
|