Stone.js API
    Preparing search index...

    Interface representing a Container.

    This interface defines the public contract for dependency injection containers, allowing for better testability and preventing circular dependencies.

    Mr. Stone evensstone@gmail.com

    interface IContainer {
        alias: (key: BindingKey, aliases: string | string[]) => this;
        autoBinding: <V extends BindingValue>(
            name: BindingKey,
            item?: V,
            singleton?: boolean,
            alias?: string | string[],
        ) => this;
        binding: <V extends BindingValue>(
            key: BindingKey,
            resolver: Resolver<V>,
        ) => this;
        bindingIf: <V extends BindingValue>(
            key: BindingKey,
            resolver: Resolver<V>,
        ) => this;
        bound: (key: BindingKey) => boolean;
        clear: () => this;
        factory: <V extends BindingValue>(key: BindingKey) => () => V;
        getAliases: () => Map<string, BindingKey>;
        getAliasKey: (alias: BindingKey) => BindingKey;
        getBindings: () => Map<BindingKey, IBinding<BindingValue>>;
        has: (key: BindingKey) => boolean;
        instance: (key: BindingKey, value: BindingValue) => this;
        instanceIf: (key: BindingKey, value: BindingValue) => this;
        isAlias: (alias: BindingKey) => boolean;
        make: <V extends BindingValue>(key: BindingKey) => V;
        resolve: <V extends BindingValue>(
            key: BindingKey,
            singleton?: boolean,
        ) => V;
        singleton: <V extends BindingValue>(
            key: BindingKey,
            resolver: Resolver<V>,
        ) => this;
        singletonIf: <V extends BindingValue>(
            key: BindingKey,
            resolver: Resolver<V>,
        ) => this;
    }

    Implemented by

    Index
    alias: (key: BindingKey, aliases: string | string[]) => this

    Set a binding as alias.

    autoBinding: <V extends BindingValue>(
        name: BindingKey,
        item?: V,
        singleton?: boolean,
        alias?: string | string[],
    ) => this

    AutoBind value to the service container.

    binding: <V extends BindingValue>(
        key: BindingKey,
        resolver: Resolver<V>,
    ) => this

    Bind a resolver function into the container under the provided key, returning a new instance each time.

    bindingIf: <V extends BindingValue>(
        key: BindingKey,
        resolver: Resolver<V>,
    ) => this

    Bind a resolver function into the container under the provided key, returning a new instance each time if not already bound.

    bound: (key: BindingKey) => boolean

    Check if a value is already bound in the container by its key.

    clear: () => this

    Reset the container so that all bindings are removed.

    factory: <V extends BindingValue>(key: BindingKey) => () => V

    Resolve a value from the container by its key and return it in a factory function.

    getAliases: () => Map<string, BindingKey>

    Retrieve the value of the aliases property.

    getAliasKey: (alias: BindingKey) => BindingKey

    Get a binding key by its alias.

    getBindings: () => Map<BindingKey, IBinding<BindingValue>>

    Retrieve the value of the bindings property.

    has: (key: BindingKey) => boolean

    Check if a value is already bound in the container by its key.

    instance: (key: BindingKey, value: BindingValue) => this

    Bind a single instance or value into the container under the provided key.

    instanceIf: (key: BindingKey, value: BindingValue) => this

    Bind a single instance or value into the container under the provided key if not already bound.

    isAlias: (alias: BindingKey) => boolean

    Check if an alias exists in the container.

    make: <V extends BindingValue>(key: BindingKey) => V

    Resolve a registered value from the container by its key.

    resolve: <V extends BindingValue>(key: BindingKey, singleton?: boolean) => V

    Resolve a value from the container by its key, binding it if necessary.

    singleton: <V extends BindingValue>(
        key: BindingKey,
        resolver: Resolver<V>,
    ) => this

    Bind a resolver function into the container under the provided key as a singleton.

    singletonIf: <V extends BindingValue>(
        key: BindingKey,
        resolver: Resolver<V>,
    ) => this

    Bind a resolver function into the container under the provided key as a singleton if not already bound.