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. worker
  5. hasPersisted

spark.worker.hasPersisted

function hasPersisted(key: string): boolean

Check if a value is already persisted.

Useful for conditional initialization or testing whether a value survived a hot reload.

Parameters

keystring
Persisted value identifier

Returns

boolean– True if the value exists in persistent storage

Examples

if (spark.hasPersisted('model')) {
  console.log('Model survived hot reload');
} else {
  console.log('Model was recreated');
}

See Also

  • persist - Persist a value
Previous
handleControlMessage
Next
isExposedFunction