Path: blob/main/extensions/ipynb/src/notebookSerializerWorker.ts
3292 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { parentPort } from 'worker_threads';6import { serializeNotebookToString } from './serializers';7import type { NotebookData } from 'vscode';8910if (parentPort) {11parentPort.on('message', ({ id, data }: { id: string; data: NotebookData }) => {12if (parentPort) {13const json = serializeNotebookToString(data);14const bytes = new TextEncoder().encode(json);15parentPort.postMessage({ id, data: bytes });16}17});18}192021