/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { ImplementationError, MatterAggregateError } from "../MatterError.js"; import { MaybePromise } from "../util/Promises.js"; export declare namespace Lifecycle { /** * Standard statuses in an object's lifecycle. */ enum Status { Unknown = "unknown", Inactive = "inactive", Initializing = "initializing", Active = "active", Crashed = "crashed", Destroying = "destroying", Destroyed = "destroyed" } /** * Lifecycle status for multiple items. */ type Map = Record; /** * Assert subject is active. */ function assertActive(status: Status, description?: string): void; } /** * Base class for errors related to the lifecycle of a dependency. */ export declare class DependencyLifecycleError extends ImplementationError { constructor(what: string, why: string); } /** * Standard interface for objects that have a primary task that may initiate after construction. */ export interface Startable { /** * Commence with the object's primary activity. * * Start should have no effect if the object is already started. */ start(): void; } /** * Standard interface for objects supporting a task that may be aborted or stopped prior to destruction. */ export interface Cancellable { /** * Stop the object's primary activity. This should result in termination as quickly as possible. * * Cancellation have no effect if the object is cancelled or otherwise in a state where cancellation is irrelevant. */ cancel(): void; } /** * Standard interface for disposing of object resources. */ export interface Destructable { close(): void | Promise; [Symbol.dispose]?: () => void; [Symbol.asyncDispose]?: () => MaybePromise; } /** * Thrown when a dependency is in an unsupported state. */ export declare class UnsupportedDependencyStatusError extends DependencyLifecycleError { } /** * Thrown for actions that cannot be performed until further initialization occurs. */ export declare class UninitializedDependencyError extends DependencyLifecycleError { } /** * Thrown for actions that cannot be performed because dependency crashed. */ export declare class CrashedDependencyError extends DependencyLifecycleError { subject?: object; } /** * Thrown for actions that cannot be performed because a dependency has been destroyed. */ export declare class DestroyedDependencyError extends DependencyLifecycleError { } /** * Thrown for actions that cannot be performed because a dependency is not supported. */ export declare class UnsupportedDependencyError extends DependencyLifecycleError { } /** * Thrown if multiple dependencies crash. */ export declare class CrashedDependenciesError extends MatterAggregateError { } //# sourceMappingURL=Lifecycle.d.ts.map