Methods
active() → {boolean}
Alias for LuCI.poll.active().
- Type:
- boolean
add(interval, url, optionsopt, callbackopt) → {function}
Register a repeating HTTP request with an optional callback to invoke whenever a response for the request is received.
| Name | Type | Attributes | Description |
|---|---|---|---|
interval | number | The poll interval in seconds. | |
url | string | The URL to request on each poll. | |
options | LuCI. | <optional> | Additional options to configure the request. |
callback | LuCI. | <optional> |
|
Throws
TypeErrorwhen an invalid interval was passed.- Type
- TypeError
Returns the internally created poll function.
- Type:
- function
remove(entry) → {boolean}
Remove a polling request that has been previously added using add(). This function is essentially a wrapper around LuCI.poll.remove().
| Name | Type | Description |
|---|---|---|
entry | function | The poll function returned by |
Returns true if any function has been removed, else false.
- Type:
- boolean
start() → {boolean}
Alias for LuCI.poll.start().
- Type:
- boolean
stop() → {boolean}
Alias for LuCI.poll.stop().
- Type:
- boolean
Type Definitions
callbackFn(res, data, duration)
The callback function is invoked whenever an HTTP reply to a polled request is received or when the polled request timed out.
| Name | Type | Description |
|---|---|---|
res | LuCI. | The HTTP response object. |
data | * | The response JSON if the response could be parsed as such, else |
duration | number | The total duration of the request in milliseconds. |