1.0.4 • Published 3 years ago

@oada/poll v1.0.4

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

OADA/poll

An oada library for regularly executing a callback, ideally for polling a remote. Users control the interval between execution. The last check time is stored at <basePath>/_meta/oada-poll/<name>.

Basic Usage Example

import { poll } from '@oada/poll'

// See type definitions for all supported options
await poll.poll({
  connection, //an @oada/client connection (oada.connect result)
  basePath: `/bookmarks/services/foo`,
  pollOnStartup: true, //execute immediately on startup (true) or wait interval (false)
  pollFunc: async() => {  },
  interval: 3600*1000 //interval time in milliseconds
  name: 'my-poll-service',
});

Optional Arguments

By default, the service checks whether it is time to poll with a frequency of interval/2. This can be controlled by the argument checkInterval, e.g.:

await poll.poll({
  ...
  checkInterval: 1000 // check interval time in milliseconds
});
1.0.2

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

4 years ago