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

spark.setParentRpc

function setParentRpc(rpc: Rpc | null): void

Set the RPC instance for proxied file saves.

In sandboxed iframes, authentication cookies are not available. This function sets up the RPC channel to the parent window, which performs saves on behalf of the sandboxed code.

This is called automatically by the spark worker setup. Most users don't need to call this directly.

Parameters

rpcRpc | null
RPC instance to the parent window, or null to disable proxied saves

Examples

// Parent window sets up RPC and passes it to iframe
const rpc = createParentRpc();
iframeWindow.setParentRpc(rpc);
Previous
setBaseUrl
Next
SparkCallMessage