Involved Source Files
Package poller supports periodic polling to load a value.
Package-Level Type Names (total 2, both are exported)
/* sort exporteds by: | */
A Getter returns a value.
func New(initial interface{}, getter Getter, onError func(error)) *Poller
A Poller maintains a current value, and refreshes it by periodically
polling for a new value.
currentinterface{}getterGettermusync.MutexonErrorfunc(error)
Current returns the current value. Initially, this is the value passed to New.
After each successful poll, the value is updated.
If a poll fails, the value remains unchanged.
Poll calls p's getter immediately and synchronously.
Start begins polling in a separate goroutine, at the given period. To stop
the goroutine, cancel the context passed to Start.
func New(initial interface{}, getter Getter, onError func(error)) *Poller
Package-Level Functions (only one, which is exported)
New creates a new poller with an initial value. The getter is invoked
to obtain updated values. Errors returned from the getter are passed
to onError.
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.