pumpit / PumpIt
- bindClass
- bindFactory
- bindValue
- child
- clearAllInstances
- clearInstance
- getParent
- has
- resolve
- unbind
- unbindAll
• new PumpIt(): PumpIt
▸ 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.
| Name | Type |
|---|---|
T |
extends ClassValue |
| 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 |
▸ 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.
| Name | Type |
|---|---|
T |
extends FactoryValue |
| 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 |
▸ bindValue<T>(key, value): PumpIt
Binds value. Value is treated as a singleton and ti will always resolve to the same data (value)
| Name |
|---|
T |
| Name | Type | Description |
|---|---|---|
key |
BindKey |
key to resolve binded value BindKey |
value |
T |
value to bind |
current pumpIt instance
▸ child(): PumpIt
Creates child PumpIt instance. Child injection instance is connected to the parent instance and it can use parent singleton values.
▸ clearAllInstances(): void
void
▸ clearInstance(key): boolean
| Name | Type |
|---|---|
key |
BindKey |
boolean
▸ getParent(): undefined | PumpIt
Gets parent injector instance
undefined | PumpIt
▸ has(key, searchParent?): boolean
| Name | Type | Default value |
|---|---|---|
key |
BindKey |
undefined |
searchParent |
boolean |
true |
boolean
▸ resolve<T>(key, opts?): T
Resolve value that has previously been binded.
| Name | Description |
|---|---|
T |
value that is going to be resolved |
| Name | Type | Description |
|---|---|---|
key |
BindKey |
key to search for BindKey |
opts? |
ResolveCtx |
options for the current resolve request ResolveCtx |
T
▸ unbind(key, dispose?): void
| Name | Type | Default value |
|---|---|---|
key |
BindKey |
undefined |
dispose |
boolean |
true |
void
▸ unbindAll(callDispose?): void
| Name | Type | Default value |
|---|---|---|
callDispose |
boolean |
true |
void