0.5.1 • Published 3 years ago

connector-observable v0.5.1

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

Connector

Connect to api and observe the response changes, like long polling

Usage

Create the observable connector by providing config to the module:

const observable = connector(config);

config has the following properties:

AttributeTypeRequiredDescription
ajaxClientanynoclient that initiate connection to server side, default to axios
ajaxConfiganynoargs provide to ajax client, default to {}
comparerfunctionnocomparer used to compare old response with new response to detect changes, default to deep compare response.data
periodnumbernotime between each ajax call in ms, default to 1000ms
cancelerfunctionnoreturn true when need to stop the observation, default to always return false