docs/Classes/VirtualTimeScheduler.html
open class VirtualTimeScheduler<Converter: VirtualTimeConverterType>:
SchedulerType
extension VirtualTimeScheduler: CustomDebugStringConvertible
Base class for virtual time schedulers using a priority queue for scheduled items.
`
VirtualTime
`
Undocumented
Swift
public typealias VirtualTime = Converter.VirtualTimeUnit
`
VirtualTimeInterval
`
Undocumented
Swift
public typealias VirtualTimeInterval = Converter.VirtualTimeIntervalUnit
`
now
`
Swift
public var now: RxTime { get }
Current time.
`
clock
`
Swift
public var clock: VirtualTime { get }
Scheduler’s absolute time clock value.
`
init(initialClock:converter:)
`
Creates a new virtual time scheduler.
Swift
public init(initialClock: VirtualTime, converter: Converter)
| initialClock |
Initial value for the clock.
|
`
schedule(_:action:)
`
Schedules an action to be executed immediately.
Swift
public func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable
| state |
State passed to the action to be executed.
|
| action |
Action to be executed.
|
The disposable object used to cancel the scheduled action (best effort).
`
scheduleRelative(_:dueTime:action:)
`
Schedules an action to be executed.
Swift
public func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable
| state |
State passed to the action to be executed.
|
| dueTime |
Relative time after which to execute the action.
|
| action |
Action to be executed.
|
The disposable object used to cancel the scheduled action (best effort).
`
scheduleRelativeVirtual(_:dueTime:action:)
`
Schedules an action to be executed after relative time has passed.
Swift
public func scheduleRelativeVirtual<StateType>(_ state: StateType, dueTime: VirtualTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable
| state |
State passed to the action to be executed.
|
| time |
Absolute time when to execute the action. If this is less or equal then now, now + 1 will be used.
|
| action |
Action to be executed.
|
The disposable object used to cancel the scheduled action (best effort).
`
scheduleAbsoluteVirtual(_:time:action:)
`
Schedules an action to be executed at absolute virtual time.
Swift
public func scheduleAbsoluteVirtual<StateType>(_ state: StateType, time: VirtualTime, action: @escaping (StateType) -> Disposable) -> Disposable
| state |
State passed to the action to be executed.
|
| time |
Absolute time when to execute the action.
|
| action |
Action to be executed.
|
The disposable object used to cancel the scheduled action (best effort).
`
adjustScheduledTime(_:)
`
Adjusts time of scheduling before adding item to schedule queue.
Swift
open func adjustScheduledTime(_ time: VirtualTime) -> VirtualTime
`
start()
`
Starts the virtual time scheduler.
Swift
public func start()
`
advanceTo(_:)
`
Advances the scheduler’s clock to the specified time, running all work till that point.
Swift
public func advanceTo(_ virtualTime: VirtualTime)
| virtualTime |
Absolute time to advance the scheduler’s clock to.
|
`
sleep(_:)
`
Advances the scheduler’s clock by the specified relative time.
Swift
public func sleep(_ virtualInterval: VirtualTimeInterval)
`
stop()
`
Stops the virtual time scheduler.
Swift
public func stop()
`
debugDescription
`
A textual representation of self, suitable for debugging.
Swift
public var debugDescription: String { get }