Skip to main content
torch.js has not been released yet.
torch.js logotorch.js logotorch.js
PlaygroundContact
Login
Documentation
IntroductionType SafetyTensor ExpressionsTensor IndexingEinsumEinopsAutogradTraining a ModelProfiling & MemoryPyTorch MigrationBest PracticesRuntimesPerformancePyTorch CompatibilityBenchmarksDType Coverage
torch.js· 2026
LegalTerms of UsePrivacy Policy
/
/
  1. docs
  2. Spark
  3. spark
  4. client
  5. setWorkerScriptUrl

spark.client.setWorkerScriptUrl

function setWorkerScriptUrl(url: string): void

Set 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);
  // ...
}
Previous
resetWorker
Next
useSpark