import { EventEmitter } from "events"; export declare const serviceProxyMarker: unique symbol; export declare const proxyTarget: unique symbol; export declare const serviceIsResolved: unique symbol; /** * Interface describing the proxy object returned by the createServiceProxy function. */ export interface ServiceProxy { [serviceProxyMarker]: boolean; [serviceIsResolved]: boolean; [proxyTarget]: ProxyTarget; } /** * Create a service proxy that will lazily create the service instance when a property is accessed. * The service instance will be created using the provided factory function. * The service itself can be switched out by assigning a new instance to the service proxy. * @param factory Factory function to create the service instance * @param prototype Prototype of the service instance * @returns Service proxy */ export declare function createServiceProxy(factory: () => T, prototype: any): ServiceProxy & T; /** * Check if the provided object is a service proxy * @param obj Object to check * @returns True if the object is a service proxy */ export declare function isServiceProxy(obj: unknown): obj is ServiceProxy; /** * Describes the events emitted by the proxy target. */ interface ProxyTargetEvents { resolved: [T]; } /** * This is the target of the service proxy. * Allows for listening to the resolved event before the service instance is created. * The service instance can be set using the setInstance method which will override the existing instance. */ export declare class ProxyTarget extends EventEmitter> { private readonly factory; instance?: T & object; private static supportedEvents; constructor(factory: () => T); on(eventName: keyof ProxyTargetEvents, listener: (...args: any[]) => void): this; once(eventName: keyof ProxyTargetEvents, listener: (...args: any[]) => void): this; listen(type: 'on' | 'once', eventName: keyof ProxyTargetEvents, listener: (...args: any[]) => void): this; setInstance(instance: T): T; getInstance(): T; } export {}; //# sourceMappingURL=serviceProxy.d.ts.map