UNPKG

@litert/televoke

Version:
49 lines 2.04 kB
/** * Copyright 2025 Angus.Fenying <fenying@litert.org> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import * as NodeWorker from 'node:worker_threads'; import * as Shared from '../../shared'; import type * as dT from '../Transporter.decl'; import { EventEmitter } from 'node:events'; declare abstract class AbstractThreadTransporter extends EventEmitter { readonly protocol: string; constructor(protocol: string); getPropertyNames(): string[]; getAllProperties(): Record<string, unknown>; getProperty(name: string): unknown; abstract destroy(): void; end(): void; protected _write(worker: NodeWorker.MessagePort | NodeWorker.Worker, frame: Array<string | Buffer>): void; protected _onMessage: (frame: unknown) => void; } export declare class MainThreadTransporter extends AbstractThreadTransporter implements dT.ITransporter, Shared.ITransporter { protected readonly _worker: NodeWorker.Worker; private _closed; constructor(protocol: string, _worker: NodeWorker.Worker); private readonly _onError; private readonly _onExit; destroy(): void; get writable(): boolean; write(frame: Array<string | Buffer>): void; } export declare class WorkerThreadTransporter extends AbstractThreadTransporter implements dT.ITransporter, Shared.ITransporter { private _hold; constructor(protocol: string); destroy(): void; get writable(): boolean; write(frame: Array<string | Buffer>): void; } export {}; //# sourceMappingURL=WorkerThread.Transporter.d.ts.map