
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
BindBox is a dependency injection container.
npm i bindbox reflect-metadata
import { Container, ParamTypes, createTypeId } from 'bindbox';
import 'reflect-metadata';
// contracts
export interface LoggerContract {
log(message: string): void;
}
export interface StorageContract {
get(key: string): string | null;
set(key: string, value: string): void;
remove(key: string): void;
}
// implementations
export class Logger implements LoggerContract {
log(message: string): void {
console.log(message);
}
}
export class LocalStorage implements StorageContract {
constructor(private logger: LoggerContract) {
this.logger.log('LocalStorage inited');
}
get(key: string): string | null {
return localStorage.getItem(key);
}
set(key: string, value: string): void {
localStorage.setItem(key, value);
}
remove(key: string): void {
localStorage.removeItem(key);
}
}
export class MemoryStorage implements StorageContract {
#data = new Map<string, string>();
constructor(private logger: LoggerContract) {
this.logger.log('MemoryStorage inited');
}
get(key: string): string | null {
return this.#data.get(key) ?? null;
}
set(key: string, value: string): void {
this.#data.set(key, value);
}
remove(key: string): void {
this.#data.delete(key);
}
}
// tokens
export const TStorage = createTypeId<StorageContract>('Storage');
export const TLogger = createTypeId<LoggerContract>('Logger');
// annotations
ParamTypes.define(LocalStorage, [TLogger]);
ParamTypes.define(MemoryStorage, [TLogger]);
// usage
const container = new Container();
container.bind(TStorage).to(MemoryStorage).inSingleton();
container.bind(TLogger).to(Logger).inSingleton();
const storage = container.get(TStorage);
storage.set('some', 'value');
FAQs
The dependency injection container
We found that bindbox demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.