npm.io
1.0.2 • Published 6 years ago

light-async-polling

Licence
ISC
Version
1.0.2
Deps
0
Size
2 kB
Vulns
0
Weekly
0

light-async-polling

Super light javascript function for making polling

Usage:


  const polling = require('light-async-polling')

  await polling(async () => {
    const r = yourFunction()
    if (
      r
    ) {
      return true //stop polling
    } else {
      return false //continue polling
    }

  }, 2000) //milliseconds

Run examples:

  npm run examples

Keywords