spark.client.resetWorker
function resetWorker(): voidTerminate the global worker and reset all state.
Call this to clean up when you're done with the worker or want to restart fresh. The worker is automatically terminated when the page unloads.
After calling this, the next call to useSpark() will create a new worker.
Examples
// Terminate and clean up
resetWorker();
// Next useSpark() call will create a fresh worker
const s = useSpark(torch);