Optional apply: ((self, args) => InstanceType<T>)The callback to apply on subsequent new invocations.
A class constructor decorator.
Singleton class:
import { Singleton } from '@sgrud/core';
@Singleton()
export class Service {}
new Service() === new Service(); // true
Generated using TypeDoc
Class decorator factory. Enforces a transparent Singleton pattern on the decorated class. When calling the
newoperator on a decorated class for the first time, an instance of the decorated class is created using the supplied arguments, if any. This instance will remain the Singleton instance of the decorated class indefinitely. When calling thenewoperator on a decorated class already instantiated, the Singleton pattern is enforced and the previously constructed instance is returned. Instead, if provided, theapplycallback is fired with the Singleton instance and thenewinvocation parameters.