Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/ipynb/src/notebookSerializerWorker.ts
3292 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { parentPort } from 'worker_threads';
7
import { serializeNotebookToString } from './serializers';
8
import type { NotebookData } from 'vscode';
9
10
11
if (parentPort) {
12
parentPort.on('message', ({ id, data }: { id: string; data: NotebookData }) => {
13
if (parentPort) {
14
const json = serializeNotebookToString(data);
15
const bytes = new TextEncoder().encode(json);
16
parentPort.postMessage({ id, data: bytes });
17
}
18
});
19
}
20
21