Skip to main content
Version: 1.x

@microsoft/fast-foundation > transient

transient() function

Registers the target class as a transient dependency; each time the dependency is resolved a new instance will be created.

Signature:
export declare function transient<T extends Constructable>(target: T & Partial<RegisterSelf<T>>): T & RegisterSelf<T>;

Parameters

ParameterTypeDescription
targetT & Partial<RegisterSelf<T>>The class / constructor function to register as transient.
Returns:

T & RegisterSelf<T>

Example

@transient()
class Foo { }