Methods
-
Test whether the polling loop is running.
Returns:
Type Description boolean - Returns
true
if polling is active, elsefalse
.
- Returns
-
Add a new operation to the polling loop. If the polling loop is not already started at this point, it will be implicitly started.
Name Type Description fn
function The function to invoke on each poll interval.
interval
number The poll interval in seconds.
Throws:
-
Throws
TypeError
when an invalid interval was passed. - Type
- TypeError
Returns:
Type Description boolean Returns true
if the function has been added orfalse
if it already is registered. -
-
Remove an operation from the polling loop. If no further operations are registered, the polling loop is implicitly stopped.
Name Type Description fn
function The function to remove.
Throws:
-
Throws
TypeError
when the given argument isn't a function. - Type
- TypeError
Returns:
Type Description boolean Returns true
if the function has been removed orfalse
if it wasn't found. -
-
(Re)start the polling loop. Dispatches a custom
poll-start
event to thedocument
object upon successful start.Returns:
Type Description boolean Returns true
if polling has been started (or if no functions where registered) orfalse
when the polling loop already runs. -
Stop the polling loop. Dispatches a custom
poll-stop
event to thedocument
object upon successful stop.Returns:
Type Description boolean Returns true
if polling has been stopped orfalse
if it didn't run to begin with.