mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-24 18:31:38 +01:00
Add .oxfmtignore to skip generated bindings and wasm-pack output. Add npm format script, update DEVELOPMENT.md for Vite+ toolchain, and format all non-generated files with oxfmt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
27 lines
760 B
TypeScript
27 lines
760 B
TypeScript
import type { BootRequest, InternalEvent } from "@yaakapp/api";
|
|
import type { PluginContext } from "@yaakapp-internal/plugins";
|
|
import type { EventChannel } from "./EventChannel";
|
|
import { PluginInstance, type PluginWorkerData } from "./PluginInstance";
|
|
|
|
export class PluginHandle {
|
|
#instance: PluginInstance;
|
|
|
|
constructor(
|
|
pluginRefId: string,
|
|
context: PluginContext,
|
|
bootRequest: BootRequest,
|
|
pluginToAppEvents: EventChannel,
|
|
) {
|
|
const workerData: PluginWorkerData = { pluginRefId, context, bootRequest };
|
|
this.#instance = new PluginInstance(workerData, pluginToAppEvents);
|
|
}
|
|
|
|
sendToWorker(event: InternalEvent) {
|
|
this.#instance.postMessage(event);
|
|
}
|
|
|
|
async terminate() {
|
|
await this.#instance.terminate();
|
|
}
|
|
}
|