pole-wait

Wait until a pole poller responds with an expected result

Usage no npm install needed!

<script type="module">
  import poleWait from 'https://cdn.skypack.dev/pole-wait';
</script>

README

pole-wait Build Status

Wait until a pole poller responds with an expected result

Install

$ npm install --save pole-wait

Usage

var wait = require('pole-wait')

wait(poll, (data) => data.foo, function (err, data) {
  console.log('got data!', data)
})

API

wait(poll, fn, callback) -> undefined

poll

Required
Type: object

A poll interface returned from pole.

fn

Required
Type: function
Arguments: data

A function to be called with the poll result. If the return value is truthy, the wait is considered complete and the poller is cancelled.

callback

Required
Type: function Arguments: err, data

License

MIT © Ben Drucker