Polled<S, K, V>
An external resource that is refreshed at some polling interval.
Type Parameters
Type Parameter | Description |
---|---|
S extends Json | Type of data received from external resource. |
K extends Json | Type of keys. |
V extends Json | Type of values. |
Implements
Constructors
new Polled()
new Polled<S, K, V>(
url,
duration,
conv,
encodeParams): Polled<S, K, V>
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
url | string | undefined | HTTP endpoint of external resource to poll. |
duration | number | undefined | Refresh interval, in milliseconds. |
conv | (data ) => Entry <K , V >[] | undefined | Function to convert data of type S received from external resource to key -value entries. |
encodeParams | (params ) => string | defaultParamEncoder | Function to use to encode params of type Json for external resource request. |
Returns
Polled
<S
, K
, V
>
Methods
close()
close(params): void
Parameters
Parameter | Type |
---|---|
params | Json |
Returns
void
Implementation of
open()
open(params, callbacks): void
Parameters
Parameter | Type |
---|---|
params | Json |
callbacks | { error : (error ) => void ; loading : () => void ; update : (updates , isInit ) => void ; } |
callbacks.error | (error ) => void |
callbacks.loading | () => void |
callbacks.update | (updates , isInit ) => void |
Returns
void