Skip to main content
Module

x/tstl/thread/TimedSingleton.ts>TimedSingleton

TypeScript-STL (Standard Template Library, migrated from C++)
Latest
class TimedSingleton
import { TimedSingleton } from "https://deno.land/x/tstl@v3.0.0/thread/TimedSingleton.ts";

Timed singleton generator.

The TimedSingleton is a type of Singleton class who re-constructs the singleton value repeatedly whenever specific time has been elapsed after the last lazy construction.

Constructors

new
TimedSingleton(interval: number, closure: (...args: Args) => T)

Initializer Constructor.

Type Parameters

T

Type of the value to be lazy-constructed

optional
Args extends any[] = []

Properties

private
readonly
closure_: (...args: Args) => T
private
expired_at_: number
private
readonly
interval_: number
private
value_: T

Methods

get(...args: Args): T

Get value.