Class ClosureFactory<T>

A factory whose token is produced by calling a function.

Example

let i = 0
const fact = new ClosureFactory('someName', () => {
i += 1
return i * 2
})

fact.produce([], []) // => 2
fact.produce([], []) // => 4

Type Parameters

  • T

Hierarchy

Constructors

Properties

name: any
token: (() => T)

Token that was registered for this factory. In most cases, this is the static form of the item that is to be produced by this factory.

Var

Type declaration

    • (): T
    • Returns T

Methods