A managed timer that will tick on intervals. More...
Instance Methods | |
(void) | - changeIntervalWithNewInterval: |
Changes the interval of the timer. More... | |
(NSString *) | - id |
Gets the Id of the timer. More... | |
(instancetype) | - initWithInterval:callback: |
Creates a new instance of the managed timer. More... | |
(int) | - interval |
Gets the interval that the timer will tick on. More... | |
(bool) | - inTick |
Gets whether the callback is currently being called. More... | |
(bool) | - running |
Gets whether the timer is running. More... | |
(bool) | - start |
Starts the timer. More... | |
(bool) | - stop |
Stops the timer. More... | |
(FMLiveSwitchFuture< id > *) | - stopAsync |
Stops the timer. More... | |
(bool) | - stopWithWaitForStop: |
Stops the timer. More... | |
Class Methods | |
(FMLiveSwitchManagedTimer *) | + managedTimerWithInterval:callback: |
Creates a new instance of the managed timer. More... | |
(int) | + perSecondIntervalWithTimesPerSecond: |
Calculates a interval based on how many times you want the timer to tick per second. More... | |
A managed timer that will tick on intervals.
Might catchup if callback takes too long.
- (void) changeIntervalWithNewInterval: | (int) | newInterval |
Changes the interval of the timer.
newInterval |
- (instancetype) initWithInterval: | (int) | interval | |
callback: | (FMLiveSwitchAction0 *) | callback | |
Creates a new instance of the managed timer.
interval | The millisecond interval to tick on. |
callback | The callback to use when a tick occurs. |
- (int) interval |
Gets the interval that the timer will tick on.
- (bool) inTick |
Gets whether the callback is currently being called.
+ (FMLiveSwitchManagedTimer*) managedTimerWithInterval: | (int) | interval | |
callback: | (FMLiveSwitchAction0 *) | callback | |
Creates a new instance of the managed timer.
interval | The millisecond interval to tick on. |
callback | The callback to use when a tick occurs. |
+ (int) perSecondIntervalWithTimesPerSecond: | (double) | timesPerSecond |
Calculates a interval based on how many times you want the timer to tick per second.
timesPerSecond | The amount of times to tick per second. |
- (bool) running |
Gets whether the timer is running.
- (bool) start |
Starts the timer.
false
if the timer was already started; otherwise, true
. - (bool) stop |
Stops the timer.
false
if the timer was already stopped; otherwise, true
. - (FMLiveSwitchFuture<id>*) stopAsync |
Stops the timer.
false
if the timer was already stopped; otherwise, true
. - (bool) stopWithWaitForStop: | (bool) | waitForStop |
Stops the timer.
waitForStop | True if method should block until timer is stopped. |
false
if the timer was already stopped; otherwise, true
.