Back to Rxswift

SchedulerType

docs/Protocols/SchedulerType.html

6.10.22.1 KB
Original Source

SchedulerType

public protocol SchedulerType : ImmediateSchedulerType

Represents an object that schedules units of work.

`

                now
                `

Declaration

Swift

var now: RxTime { get }

Return Value

Current time.

`

                scheduleRelative(_:dueTime:action:)
                `

Schedules an action to be executed.

Declaration

Swift

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

`

                schedulePeriodic(_:startAfter:period:action:)
                ` Default implementation 

Schedules a periodic piece of work.

Default Implementation

Periodic task will be emulated using recursive scheduling.

Declaration

Swift

func schedulePeriodic<StateType>(_ state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable

Parameters

| state |

State passed to the action to be executed.

| | startAfter |

Period after which initial work should be run.

| | period |

Period for running the work periodically.

| | action |

Action to be executed.

|

Return Value

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