Function timingSourceFactory

A factory function for creating a timing source. It returns a function which creates a designated timer.

This is useful in times where you need to recreate timers, eg for reset type of behaviours because the options for the timer to be consolidated in one place.

// Get a factory for an elapsed timer
const factory = sources(`elapsed`, 1000);

// Create the timer
let t = factory();

// Get a value from the timer
const value = t();

// Recreate the timer, note we don't need any options
t = factory();