import { WASM } from "../backend_wasm/mod.ts";import { Sequential } from "./mod.ts";import { Backend, BackendType, NetworkConfig } from "./types.ts";
window.onerror = () => { if (typeof Deno == "undefined") { throw new Error( "Warning: Deno is not defined. Did you mean to import from ./web.ts instead of ./mod.ts?", ); }};
export interface BackendInstance { init(): Promise<void>;}
export interface BackendLoader { setup(silent: boolean): Promise<boolean>;
loadBackend(config: NetworkConfig): Backend;
loadFile(path: string): Sequential;
load(data: Uint8Array): Sequential;}
export async function setupBackend(loader: BackendLoader, silent = false) { const success = await loader.setup(silent); if (!success) { if (!silent) console.log("Defaulting to CPU Backend"); await WASM.setup(silent); } Engine.backendLoader = loader;}
export class Engine { static backendLoader: BackendLoader;
static type: BackendType;}