public final class JSTimer
This timer is an abstraction over
needed to hold a reference to the timer closure and to call
JSClosure.release() on it when the
timer is deallocated. As a user, you have to hold a reference to a
JSTimer instance for it to stay
JSTimer API is also intentionally trivial, the timer is started right away, and the
only way to invalidate the timer is to bring the reference count of the
JSTimer instance to zero.
For invalidation you should either store the timer in an optional property and assign
nil to it,
or deallocate the object that owns the timer.
public init(millisecondsDelay: Double, isRepeating: Bool = false, callback: @escaping () -> ())
Creates a new timer instance that calls
under the hood.
the amount of milliseconds before the
the closure to be executed after a given
public let isRepeating: Bool
Indicates whether this timer instance calls its callback repeatedly at a given delay.