Liking cljdoc? Tell your friends :D

cljest.timers


advance-timers-by-timecljs

(advance-timers-by-time ms)

Advances timers by the provides ms value. Will run any macrotasks that are currently or get queued within that time frame.

Advances timers by the provides `ms` value. Will run any macrotasks that are currently
or get queued within that time frame.
sourceraw docstring

advance-timers-by-time+cljs

(advance-timers-by-time+ ms)

Async version of advance-timers-by-time. Runs scheduled promises before macrotasks.

Async version of advance-timers-by-time. Runs scheduled promises _before_ macrotasks.
sourceraw docstring

advance-timers-to-next-timercljs

(advance-timers-to-next-timer)
(advance-timers-to-next-timer steps)

Advances all timers by the needed milliseconds so that only the next timeouts/intervals will run.

If given, will run steps amount of next timeouts/intervals.

Advances all timers by the needed milliseconds so that only the next timeouts/intervals will run.

If given, will run `steps` amount of next timeouts/intervals.
sourceraw docstring

advance-timers-to-next-timer+cljs

(advance-timers-to-next-timer+)
(advance-timers-to-next-timer+ steps)

Async version of advance-timers-to-next-timer. Runs scheduled promises before timers.

Async version of `advance-timers-to-next-timer`. Runs scheduled promises _before_ timers.
sourceraw docstring

clear-all-timerscljs

(clear-all-timers)

Removes all pending timers.

Removes all pending timers.
sourceraw docstring

get-real-system-timecljs

(get-real-system-time)

Gets the actual system time, even if the timers are currently faked.

Gets the actual system time, even if the timers are currently faked.
sourceraw docstring

get-timer-countcljs

(get-timer-count)

Gets the count of queued timers.

Gets the count of queued timers.
sourceraw docstring

nowcljs

(now)

Returns current clock time, in ms. Equivalent to (js/Date.now) if using real timers or if Date is mocked.

Returns current clock time, in ms. Equivalent to `(js/Date.now)` if using real timers or if `Date` is mocked.
sourceraw docstring

run-all-tickscljs

(run-all-ticks)

Exhaust the microtask queue (runs all pending tasks queued via process.nextTick).

Exhaust the microtask queue (runs all pending tasks queued via process.nextTick).
sourceraw docstring

run-all-timerscljs

(run-all-timers)

Exhaust the macrotask and microtask queues.

Exhaust the macrotask and microtask queues.
sourceraw docstring

run-all-timers+cljs

(run-all-timers+)

Async version of run-all-timers. Runs any schedules promises before timers.

Async version of run-all-timers. Runs any schedules promises _before_ timers.
sourceraw docstring

run-only-pending-timerscljs

(run-only-pending-timers)

Executes only the currently pending macrotasks. Does not exhaust and any newly queued macrotasks won't get executed.

Executes only the currently pending macrotasks. Does not exhaust and any newly queued macrotasks
won't get executed.
sourceraw docstring

run-only-pending-timers+cljs

(run-only-pending-timers+)

Async version of run-only-pending-timers. Runs scheduled promise callbacks before executing pending macrotasks.

Async version of `run-only-pending-timers`. Runs scheduled promise callbacks _before_ executing pending
macrotasks.
sourceraw docstring

set-system-timecljs

(set-system-time)
(set-system-time now)

Sets the current system time used by the fake timers. Will not run any pending timers, even if changing the time to the future would theoretically cause them to run.

Sets the current system time used by the fake timers. Will _not_ run any pending timers, even if changing the time
to the future would theoretically cause them to run.
sourceraw docstring

use-fake-timers!cljs

(use-fake-timers!)
(use-fake-timers! options)

Uses fake timers within this block of tests, essentially calling jest.useFakeTimers before each test and useRealTimers after each test.

Must be run on the top or describe level. For test level fake timers, use cljest.timers/with-fake-timers.

Uses fake timers within this block of tests, essentially calling `jest.useFakeTimers`
before each test and `useRealTimers` after each test.

Must be run on the top or describe level. For test level fake timers,
use `cljest.timers/with-fake-timers`.
sourceraw docstring

with-fake-timersclj/smacro

(with-fake-timers maybe-options & other-forms)

Runs the provided forms with fake timers, resetting to using real timers at the end of the forms execution. Handles promises.

You can optionally provide options to the fake timers setup, and these options must be a JS value (you need to use the #js reader).

Runs the provided forms with fake timers, resetting to using real timers at the
end of the forms execution. Handles promises.

You can optionally provide options to the fake timers setup, and these options
must be a JS value (you need to use the #js reader).
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close