init(millisecondsDelay:isRepeating:callback:)
Creates a new timer instance that calls setInterval
or setTimeout
JavaScript functions for you under the hood.
init(millisecondsDelay: Double, isRepeating: Bool = false, callback: @escaping () -> ())
millisecondsDelay: the amount of milliseconds before the
callback
closure is executed.isRepeating: when
true
thecallback
closure is executed repeatedly at givenmillisecondsDelay
intervals indefinitely until the timer is deallocated.callback: the closure to be executed after a given
millisecondsDelay
interval.