Skip to content

v1.0.0

Compare
Choose a tag to compare
@kleinfreund kleinfreund released this 04 Aug 07:26
· 93 commits to main since this release

poll

I’ve ported the poll function to TypeScript to give me a comfortable way of creating both a CommonJS and an ES module out of a single source. This comes with the downside of not being able to produce a CommonJS module which uses module.exports = poll. I can only get the TypeScript compiler to produce exports.default = poll or exports.poll = poll. What this means is that you can’t have a CommonJS module compiled from a TypeScript source which you can import with require('poll').

Breaking changes:

  • Importing the CommonJS module with require('poll') no longer resolves to the poll function. Use require('poll').default instead.

    const poll = require('poll').default;

Non-breaking changes:

  • The package is now available as an ES module. If you use poll as animport poll from 'poll/dist/esm/poll.mjs'; dependency, import it like this:

    import poll from 'poll/dist/esm/poll.mjs';
  • Tests now use Jest instead of Ava.

  • Tests are now based on fake timers instead of calling setTimeout in the tests directly. Unfortunately, tests still require a lot of trickery to manually clear out the promise queue. If you know how to test this without sprinkling await Promise.resolve() all over my tests, I’m all ears!