Skip to content

Latest commit

 

History

History
73 lines (43 loc) · 1.72 KB

DependsOn.md

File metadata and controls

73 lines (43 loc) · 1.72 KB

@unlib-js/depiDocs


@unlib-js/depi / decorators/DependsOn

decorators/DependsOn

Type Aliases

DependsOnOptions<T>

DependsOnOptions<T>: keyof InstanceType<T>[] | object

Type Parameters

Type Parameter
T extends AnyConstructor

Defined in

decorators/DependsOn.ts:6

Functions

default()

default<T>(opts): (clazz) => undefined | T

A decorator that tracks the dependencies of a class.

This dependency information can be used to indicate that the decorated class should be destroyed before its dependencies.

It achieves this by doing the following:

  • Wrap the constructor to store dependencies in the constructor's parameters specified by opts.params in the [symbols.ctorDeps] property.
  • Add the dependencies in properties specified by opts.props to the metadata on the class.

Type Parameters

Type Parameter
T extends AnyConstructor

Parameters

Parameter Type Description
opts DependsOnOptions<T> An array of property keys or an object describing the properties and constructor parameters that the decorated class depends on.

Returns

Function

A decorator function that can be applied to a class.

Parameters
Parameter Type
clazz T
Returns

undefined | T

Defined in

decorators/DependsOn.ts:30