Table of Contents

Interface ITimerService

Namespace
SampSharp.Entities
Assembly
SampSharp.OpenMp.Entities.dll

Provides methods for starting and stopping timers.

public interface ITimerService
Extension Methods

Methods

Delay(Action<IServiceProvider>, TimeSpan)

Starts a timer with the specified action which will tick only once after the specified delay.

TimerReference Delay(Action<IServiceProvider> action, TimeSpan delay)

Parameters

action Action<IServiceProvider>

The action perform at the ticker

delay TimeSpan

The delay after which the timer will tick.

Returns

TimerReference

A reference to the started timer

Start(Action<IServiceProvider, TimerReference>, TimeSpan)

Starts a timer with the specified interval and action.

TimerReference Start(Action<IServiceProvider, TimerReference> action, TimeSpan interval)

Parameters

action Action<IServiceProvider, TimerReference>

The action to perform each timer tick.

interval TimeSpan

The interval at which to tick.

Returns

TimerReference

A reference to the started timer.

Start(Action<IServiceProvider>, TimeSpan)

Starts a timer with the specified interval and action.

TimerReference Start(Action<IServiceProvider> action, TimeSpan interval)

Parameters

action Action<IServiceProvider>

The action to perform each timer tick.

interval TimeSpan

The interval at which to tick.

Returns

TimerReference

A reference to the started timer.

Stop(TimerReference)

Stops the specified timer.

void Stop(TimerReference timer)

Parameters

timer TimerReference

The timer to stop.