ScopedObject ¶
export type ScopedObject = {
scope: Scope<unknown>?,
destroy: () -> ()
}
An object designed for use with scopes.
Objects satisfying this interface can be probed for information about their lifetime and how long they live relative to other objects satisfying this interface.
These objects are also recognised by doCleanup
.
Members¶
scope : Scope<unknown>? ¶
The scope which this object was constructed with, or nil
if the object has
been destroyed.
Unchanged until destruction
The scope
is expected to be set once upon construction. It should not be
assigned to again, except when the scope is destroyed - at which point it
should be set to nil
to indicate that it no longer exists inside of a
scope. This is typically done inside of oldestTask
.
oldestTask : unknown ¶
The value inside of scope
representing the point at which the scoped object
will be destroyed.
Unchanged until destruction
The oldestTask
is expected to be set once upon construction. It should not
be assigned to again.
oldestTask
is typically a callback that cleans up the object, but it's
typed ambiguously here as it is only used as a reference for lifetime
analysis, representing the point beyond which the object can be considered
completely destroyed. It shouldn't be used for much else.