Expand all

mediawiki.visibleTimeout

A library similar to similar to setTimeout and clearTimeout, that pauses the time when page visibility is hidden.

Methods

clear(visibleId)static #

Cancel a visible timeout previously established by calling set.

Passing an invalid ID silently does nothing.

Parameters:

Name Type Description
visibleId number

The identifier of the visible timeout you want to cancel. This ID was returned by the corresponding call to set().

Source:
Cancel a visible timeout previously established by calling set.

set(fn, delay) → {number}static #

Generally similar to setTimeout, but pauses the time when page visibility is hidden.

The provided function is invoked after the page has been cumulatively visible for the specified number of milliseconds.

Parameters:

Name Type Description
fn function

Callback

delay number

Time left, in milliseconds.

Source:

Returns:

A positive integer value which identifies the timer. This value can be passed to clear() to cancel the timeout.

Type
number
Generally similar to setTimeout, but pauses the time when page visibility is hidden.