Methods
-
Test whether the polling loop is running.
Returns:
Type Description boolean - Returns
trueif 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 fnfunction The function to invoke on each poll interval.
intervalnumber The poll interval in seconds.
Throws:
-
Throws
TypeErrorwhen an invalid interval was passed. - Type
- TypeError
Returns:
Type Description boolean Returns trueif the function has been added orfalseif 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 fnfunction The function to remove.
Throws:
-
Throws
TypeErrorwhen the given argument isn't a function. - Type
- TypeError
Returns:
Type Description boolean Returns trueif the function has been removed orfalseif it wasn't found. -
-
(Re)start the polling loop. Dispatches a custom
poll-startevent to thedocumentobject upon successful start.Returns:
Type Description boolean Returns trueif polling has been started (or if no functions where registered) orfalsewhen the polling loop already runs. -
Stop the polling loop. Dispatches a custom
poll-stopevent to thedocumentobject upon successful stop.Returns:
Type Description boolean Returns trueif polling has been stopped orfalseif it didn't run to begin with.