1.0.0 • Published 6 years ago
interval-as-class v1.0.0
interval-as-class
setTimeout, just as a class.
Usage
The package exports the Interval class as default export.
Interval(func, time, { aligned, offset, start})
Creates a new Interval instance.
The following arguments are supported:
func: The function that should be called at each intervaltime: The time between each function call in millisecondsaligned: Iftrue, aligns the time of the function calls whenDate.now() % timeis close to zero (default:false)offset: Ifalignedistrue, this value will be used as offset to the aligned time (default:0)start: Iftrue, theIntervalwill start immediately without callingstart()
start()
Starts calling the function at the given intervals.
stop()
Stops calling the function.
1.0.0
6 years ago