Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more
Module

x/lambda_ioc/lambda-ioc/deno/index.ts>singleton

Super type safe dependency injection ๐Ÿ’‰ for TypeScript (inspired by Diddly)
Latest
function singleton
import { singleton } from "https://deno.land/x/lambda_ioc@1.0.0/lambda-ioc/deno/index.ts";

Given a dependency factory, returns a new factory that will always resolve the same instance of the dependency.

Type Parameters

TVal
TSyncDependencies extends Record<ContainerKey, unknown>

Parameters

factory: SyncDependencyFactory<TVal, ReadableSyncContainer<TSyncDependencies>>