Module

Effect.Timer

Package
purescript-js-timers
Repository
purescript-contrib/purescript-js-timers

#TimeoutId Source

newtype TimeoutId

The ID of a timer started with setTimeout.

Instances

#setTimeout Source

setTimeout :: Int -> Effect Unit -> Effect TimeoutId

Runs an effectful function after the specified delay in milliseconds. The returned TimeoutId can be used to cancel the timer before it completes.

The timeout delay value is capped at 4ms by the JS API, any value less than this will be clamped.

#clearTimeout Source

clearTimeout :: TimeoutId -> Effect Unit

Cancels a timeout. If the timeout has already been cancelled or has already elapsed this will have no effect.

#IntervalId Source

newtype IntervalId

The ID of a timer started with setInterval.

Instances

#setInterval Source

setInterval :: Int -> Effect Unit -> Effect IntervalId

Runs an effectful function after on a set interval with the specified delay in milliseconds between iterations. The returned IntervalId can be used to cancel the timer and prevent the interval from running any further.

The interval delay value is capped at 4ms by the JS API, any value less than this will be clamped.

#clearInterval Source

clearInterval :: IntervalId -> Effect Unit

Cancels an interval timer. If the interval has already been cancelled this will have no effect.

Modules
Effect.Timer