connector-observable

0.5.1 • Public • Published

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:

Attribute Type Required Description
ajaxClient any no client that initiate connection to server side, default to axios
ajaxConfig any no args provide to ajax client, default to {}
comparer function no comparer used to compare old response with new response to detect changes, default to deep compare response.data
period number no time between each ajax call in ms, default to 1000ms
canceler function no return true when need to stop the observation, default to always return false

Package Sidebar

Install

npm i connector-observable

Weekly Downloads

1

Version

0.5.1

License

MIT

Unpacked Size

7.57 kB

Total Files

7

Last publish

Collaborators

  • will32