@dialstack/sdk-dev / native/src / RuntimeHold
Class: RuntimeHold
Defined in: sdk/native/src/bridge/RuntimeHold.ts:18
"Keep this JS runtime alive" as a promise the platform can await.
Android's HeadlessJsTaskService tears the runtime down the moment the task promise settles, so a wake holds this from the instant the task starts until live calls hit zero. What the hold actually covers is the gap before the call library's foreground service exists — once that is up it holds the process, and a ceiling reached mid-call ends only this task, not the call (measured: a 60s ring survived the then-45s ceiling untouched).
So the ceiling is a bound on a wake that never delivers, not a correctness guarantee. It is set to the same 300s as the max park/ring, the service's task timeout, the OS answer deadline and the library's incoming-call timeout purely so the numbers don't contradict each other; keep them aligned.
Constructors
Constructor
new RuntimeHold(ceilingMs?, timers?): RuntimeHold;
Defined in: sdk/native/src/bridge/RuntimeHold.ts:22
Parameters
ceilingMs?
number = 300_000
timers?
BridgeTimers = jsTimers
Returns
RuntimeHold
Methods
acquire()
acquire(): Promise<void>;
Defined in: sdk/native/src/bridge/RuntimeHold.ts:27
Returns
Promise<void>
pending()
pending(): Promise<void> | null;
Defined in: sdk/native/src/bridge/RuntimeHold.ts:44
Non-null while a hold is in flight — the reliable "a wake is mid-flight" signal.
Returns
Promise<void> | null
releaseNow()
releaseNow(): void;
Defined in: sdk/native/src/bridge/RuntimeHold.ts:39
Returns
void