Back to Rxswift

VirtualTimeScheduler

docs/Classes/VirtualTimeScheduler.html

6.10.25.6 KB
Original Source

VirtualTimeScheduler

open class VirtualTimeScheduler<Converter: VirtualTimeConverterType>:
    SchedulerType
extension VirtualTimeScheduler: CustomDebugStringConvertible

Base class for virtual time schedulers using a priority queue for scheduled items.

`

                VirtualTime
                `

Undocumented

Declaration

Swift

public typealias VirtualTime = Converter.VirtualTimeUnit

`

                VirtualTimeInterval
                `

Undocumented

Declaration

Swift

public typealias VirtualTimeInterval = Converter.VirtualTimeIntervalUnit

`

                now
                `

Declaration

Swift

public var now: RxTime { get }

Return Value

Current time.

`

                clock
                `

Declaration

Swift

public var clock: VirtualTime { get }

Return Value

Scheduler’s absolute time clock value.

`

                init(initialClock:converter:)
                `

Creates a new virtual time scheduler.

Declaration

Swift

public init(initialClock: VirtualTime, converter: Converter)

Parameters

| initialClock |

Initial value for the clock.

|

`

                schedule(_:action:)
                `

Schedules an action to be executed immediately.

Declaration

Swift

public func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable

Parameters

| state |

State passed to the action to be executed.

| | action |

Action to be executed.

|

Return Value

The disposable object used to cancel the scheduled action (best effort).

`

                scheduleRelative(_:dueTime:action:)
                `

Schedules an action to be executed.

Declaration

Swift

public func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable

Parameters

| state |

State passed to the action to be executed.

| | dueTime |

Relative time after which to execute the action.

| | action |

Action to be executed.

|

Return Value

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.

Declaration

Swift

public func scheduleRelativeVirtual<StateType>(_ state: StateType, dueTime: VirtualTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable

Parameters

| 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.

|

Return Value

The disposable object used to cancel the scheduled action (best effort).

`

                scheduleAbsoluteVirtual(_:time:action:)
                `

Schedules an action to be executed at absolute virtual time.

Declaration

Swift

public func scheduleAbsoluteVirtual<StateType>(_ state: StateType, time: VirtualTime, action: @escaping (StateType) -> Disposable) -> Disposable

Parameters

| state |

State passed to the action to be executed.

| | time |

Absolute time when to execute the action.

| | action |

Action to be executed.

|

Return Value

The disposable object used to cancel the scheduled action (best effort).

`

                adjustScheduledTime(_:)
                `

Adjusts time of scheduling before adding item to schedule queue.

Declaration

Swift

open func adjustScheduledTime(_ time: VirtualTime) -> VirtualTime

`

                start()
                `

Starts the virtual time scheduler.

Declaration

Swift

public func start()

`

                advanceTo(_:)
                `

Advances the scheduler’s clock to the specified time, running all work till that point.

Declaration

Swift

public func advanceTo(_ virtualTime: VirtualTime)

Parameters

| virtualTime |

Absolute time to advance the scheduler’s clock to.

|

`

                sleep(_:)
                `

Advances the scheduler’s clock by the specified relative time.

Declaration

Swift

public func sleep(_ virtualInterval: VirtualTimeInterval)

`

                stop()
                `

Stops the virtual time scheduler.

Declaration

Swift

public func stop()

description

`

                debugDescription
                `

A textual representation of self, suitable for debugging.

Declaration

Swift

public var debugDescription: String { get }