import type { Metadata } from '@devvit/protos/lib/Types.js'; import type { LinkedBundle } from '@devvit/protos/types/devvit/runtime/bundle.js'; import type { CallResponse, PluginOptions } from '../runtime/RuntimeLite.js'; import type { LiteLoadResponse } from './ClientShared.js'; export type WorkerErrorType = 'Error' | 'MessageError' | 'UnhandledRejection'; export type ErrorCallback = (type: WorkerErrorType, err: unknown) => void; export type LiteClient = { call(method: string, args: unknown, meta: Metadata | undefined): Promise; loadBundle(app: Readonly): Promise; onPluginResponse(id: number, result: CallResponse): void; runtimeDebugLogging: boolean; initializeWorker(): void; quit(): void; ready: boolean; }; /** * Wraps worker, runtime lifecycles, and call un/packing. * * Used by Shreddit via devvit-surface and devvit-custom-post(deprecated). A feed would have one client per * post. Not used by native mobile apps which doesn't have workers. * * Web workers can run code from data URI or URL of window origin. */ export declare class BrowserLiteClient implements LiteClient { #private; /** @arg onError Worker error event handler. */ constructor(workerSrc: string | Blob, name: string, onError?: ErrorCallback, pluginOptions?: PluginOptions); initializeWorker(): void; get ready(): boolean; get runtimeDebugLogging(): boolean; set runtimeDebugLogging(on: boolean); /** * This function doesn't actually load a bundle by itself. * It stores the bundle in the state and waits for ActorResponse.READY which * eventually kicks off a bundle load. * It will also initialize the worker if it was terminated during the bundle reload */ loadBundle(bundle: LinkedBundle): Promise; call(method: string, args: unknown, meta: Metadata | undefined): Promise; onPluginResponse(id: number, result: CallResponse): void; /** Call this method before repeating a call to loadBundle(). */ quit(): void; } //# sourceMappingURL=BrowserLiteClient.d.ts.map