Creates a new scope optionally owned by an explicit parent.
The explicit parent scope, null for an explicit root scope, or the current active scope when omitted.
ScopeError - When parent was already disposed.
Disposes this scope and all resources currently owned by it.
Deletes the value stored directly on this scope for the given slot.
The slot to delete locally.
True when a local value was removed.
ScopeError - When the scope was already disposed.
Disposes this scope and all resources currently owned by it.
Returns the current parent scope, or null when this scope currently has no parent.
The current parent scope, or null when there is none.
Returns whether this scope stores a local value for the given slot.
The slot to test.
True when this scope has a local value for the slot.
Returns whether this scope already ran its disposal sequence.
True when this scope was already disposed.
Registers a cleanup callback to run when this scope is disposed.
The cleanup callback to register.
Runs the given callback with this scope active.
Only the synchronous execution of the callback belongs to this scope. Work created after an await no longer belongs to this
scope. If the callback returns a promise, that promise is returned as-is and is not awaited.
The callback to run inside this scope.
The value returned by the callback.
ScopeError - When the scope was already disposed.
Stores one scope-local value on this scope.
The stored value.
ScopeError - When the scope was already disposed.
Public scope for lifetime, disposal, and scope-local values.
A scope owns disposal callbacks registered while run executes synchronously and stores local values through scope slots.