ReadonlydisposedWhether dispose() has already run.
ReadonlynameDiagnostic name, including the parent path for child scopes.
ReadonlysizeNumber of cleanup entries still held. Framework-owned leak gates read this.
Transfers ownership of a detached child to this scope in constant time. If the parent is already disposed, the child is disposed immediately instead.
Registers a synchronous cleanup callback. It runs in LIFO order with owned registrations, or immediately when the scope is already disposed.
Creates a child that is not yet owned by this scope.
Activation builds into a detached child so a failure can dispose only that
child, leaving already-committed scopes untouched. Call attach() to
transfer ownership once the work succeeded.
Disposes every entry in LIFO order.
A single failure never stops the remaining entries; all failures are
collected and thrown together as a ScopeCleanupError. Repeated
calls after the first are no-ops.
Reports what this scope and its attached children still hold.
Read-only and safe at any point in the lifecycle, including after disposal, when it reports zero.
Takes ownership of a registration and returns it unchanged.
Registering into an already-disposed scope disposes the registration immediately rather than leaking it. An exception from that immediate disposal propagates to the caller.
A dispose() that returns a promise is rejected: this scope's whole
purpose is that teardown has finished by the time it returns. Own such a
resource in a ResourceScope instead.
Owns registrations that must be released synchronously, so that stopping the host closes ingress immediately: no new command invocation or event callback can arrive after
dispose()returns.Use this for command registrations, event subscriptions, view registrations and watchers. Anything needing async teardown belongs in a
ResourceScope.Example