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. getGlobalState

spark.client.getGlobalState

function getGlobalState(): SparkState | null

Get the current global worker state (for debugging).

Returns internal state including exposed values, history, status, readiness, and any errors. Useful for inspection and debugging, but not needed for normal usage.

Returns

SparkState | null– Current state or null if not initialized

Examples

const state = getGlobalState();
if (state) {
  console.log('Worker values:', state.values);
  console.log('Worker status:', state.status);
  console.log('Worker error:', state.error);
}

Use for debugging only

Previous
SparkWorkerApi
Next
isWorkerInitialized