spark.client.setWorkerScriptUrl
function setWorkerScriptUrl(url: string): voidSet the URL for the worker script bundle.
The worker script is pre-built and bundled separately. You must call this before calling useSpark() to tell the system where to load it from.
Parameters
urlstring- URL to the worker script (e.g., '/spark-worker.js')
Examples
import { setWorkerScriptUrl, useSpark } from '@torchjsorg/spark/client';
setWorkerScriptUrl('/spark-worker.js');
function MyComponent() {
const s = useSpark(torch);
// ...
}