UNPKG

mmlpx

Version:

mobx model layer paradigm

38 lines (37 loc) 995 B
/** * Created by Kuitos * @homepage https://github.com/kuitos/ * @since 2017/12/25 */ import { Constructor } from './meta'; export declare const enum Scope { Singleton = "singleton", Prototype = "prototype" } export declare type InjectionOptions = { name?: string; scope: Scope; }; export declare type Snapshot = { [propName: string]: any; }; export declare type Entry<K, V> = { k: K; v: V; e?: number; }; export interface IContainer<K, V> { set(key: K, value: V): boolean; get(key: K): V | undefined; dump(): Array<Entry<K, V>>; load(cacheEntries: ReadonlyArray<Entry<K, V>>): void; } export default class Injector { private readonly container; private constructor(); static newInstance(container?: IContainer<string, any>): Injector; _getContainer(): IContainer<string, any>; get<T>(InjectedClass: Constructor<T>, options: InjectionOptions, ...args: any[]): T; dump(): Snapshot; load(snapshot: Snapshot): void; }