Skip to main content

Function: tag()

function tag<Target, TagData>(tagDataConstructor): object;

Creates a tag data accessor for a target object of a certain type. Tag data will be lazy created on access and reused for the same target object.

Type Parameters​

Type ParameterDescription
Target extends objectTarget type.
TagDataTag data type.

Parameters​

ParameterTypeDescription
tagDataConstructor(target) => TagDataFunction that will be called the first time the tag for a given object is requested.

Returns​

object

The tag data associated with the target object.

for()​

for(target): TagData;

Parameters​

ParameterType
targetTarget

Returns​

TagData