Skip to content

Latest commit

 

History

History
284 lines (165 loc) · 5.88 KB

File metadata and controls

284 lines (165 loc) · 5.88 KB

pumpit / PumpIt

Class: PumpIt

Table of contents

Constructors

Methods

Constructors

constructor

new PumpIt(): PumpIt

Returns

PumpIt

Methods

bindClass

bindClass<T>(key, value, options?): PumpIt

Binds class. Class constructor that is binded will be executed with the "new" call when resolved. Number of executions depends on the scope used.

Type parameters

Name Type
T extends ClassValue

Parameters

Name Type Description
key BindKey key to resolve binded value BindKey
value T class to bind
options? Omit<Partial<ClassOptions<T, "SINGLETON" | "TRANSIENT" | "REQUEST" | "CONTAINER_SINGLETON">>, "type"> bind options for factory ClassOptions

Returns

PumpIt

Defined in

pumpit.ts:211


bindFactory

bindFactory<T>(key, value, options?): PumpIt

Binds a factory function. Function that is binded will be executed when resolved and the value will be returned. Number of executions depends on the scope used.

Type parameters

Name Type
T extends FactoryValue

Parameters

Name Type Description
key BindKey key to resolve binded value BindKey
value T factory function to bind
options? Omit<Partial<FactoryOptions<T, "SINGLETON" | "TRANSIENT" | "REQUEST" | "CONTAINER_SINGLETON">>, "type"> bind options FactoryOptions

Returns

PumpIt

Defined in

pumpit.ts:159


bindValue

bindValue<T>(key, value): PumpIt

Binds value. Value is treated as a singleton and ti will always resolve to the same data (value)

Type parameters

Name
T

Parameters

Name Type Description
key BindKey key to resolve binded value BindKey
value T value to bind

Returns

PumpIt

current pumpIt instance

Defined in

pumpit.ts:141


child

child(): PumpIt

Creates child PumpIt instance. Child injection instance is connected to the parent instance and it can use parent singleton values.

Returns

PumpIt

Defined in

pumpit.ts:269


clearAllInstances

clearAllInstances(): void

Returns

void

Defined in

pumpit.ts:97


clearInstance

clearInstance(key): boolean

Parameters

Name Type
key BindKey

Returns

boolean

Defined in

pumpit.ts:104


getParent

getParent(): undefined | PumpIt

Gets parent injector instance

Returns

undefined | PumpIt

Defined in

pumpit.ts:279


has

has(key, searchParent?): boolean

Parameters

Name Type Default value
key BindKey undefined
searchParent boolean true

Returns

boolean

Defined in

pumpit.ts:126


resolve

resolve<T>(key, opts?): T

Resolve value that has previously been binded.

Type parameters

Name Description
T value that is going to be resolved

Parameters

Name Type Description
key BindKey key to search for BindKey
opts? ResolveCtx options for the current resolve request ResolveCtx

Returns

T

Defined in

pumpit.ts:242


unbind

unbind(key, dispose?): void

Parameters

Name Type Default value
key BindKey undefined
dispose boolean true

Returns

void

Defined in

pumpit.ts:61


unbindAll

unbindAll(callDispose?): void

Parameters

Name Type Default value
callDispose boolean true

Returns

void

Defined in

pumpit.ts:89