/** * @license * Copyright 2022-2024 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { Diagnostic } from "../log/Diagnostic.js"; import { Observable } from "../util/Observable.js"; import type { Environment } from "./Environment.js"; export declare namespace Environmental { const create: unique symbol; /** * An "environmental service" is an object available via {@link Environment.get}. * * Any object may be an environmental service. This methods in this interface are optional. */ interface Service { /** * Asynchronous construction, respected by {@link Environment.load}. */ construction?: Promise; /** * Asynchronous destruction. Invoked by the environment when it is destroyed. */ [Symbol.asyncDispose]?: () => Promise; /** * Standard diagnostic presentation. */ [Diagnostic.presentation]?: Diagnostic.Presentation; /** * Standard diagnostic value. */ [Diagnostic.value]?: unknown; } /** * A factory for a {@link Service}. Any constructor may be a service factory. */ interface Factory { new (...args: any[]): T; /** * The environment will create the service automatically if the factory supports {@link create}. */ [create]?: (environment: Environment) => T; } /** * Events related to service lifecycle. */ interface ServiceEvents T> { added: Observable<[instance: InstanceType]>; deleted: Observable<[instance: InstanceType]>; } } //# sourceMappingURL=Environmental.d.ts.map