spark.SparkProxy
export type SparkProxy<T extends Record<string, unknown>> = {
/**
* Map exposed values to SparkExposedValue, functions to callable async functions.
*/
[K in keyof T]: T[K] extends (...args: infer A) => infer R
? (...args: A) => Promise<Awaited<R>>
: SparkExposedValue<T[K]>;
} & {
/**
* Controller for pause/resume/stop.
*/
ctrl: SparkController;
};Textends Record<string, unknown>Reactive proxy for accessing exposed values and calling functions.
Created by spark.use(). Allows type-safe access to worker bindings.
Examples
const s = spark.use(torch);
// Access reactive value
console.log(s.loss.value);
// Set value
s.lr.set(0.001);
// Call function
await s.train();
// Control training
s.ctrl.pause();
s.ctrl.resume();
s.ctrl.stop();