<p> <a href="http://badge.fury.io/js/everytask"><img src="https://badge.fury.io/js/everytask.svg" alt="npm version"></a> <a href="https://github.com/iliasbhal/everytask/blob/main/LICENSE"> <img src="https://img.shields.io/badge/license-MIT-blue.sv
npm install everytask
The API for sheduling tasks with the event loop is very counter intuitive.
It's sometimes hard to choose between Promise.resolve().then(), setTimeout() and queueMicrotask().
Don't get me started with the differences between node and the browser.
This library aims to provide a clear isomorphic API to schdelule tasks without having to deal with all the nuances.
bash
yarn add everytask
`Usage
`ts
import * as tasks from 'everytask';tasks.task(() => console.log('called fourth'));
tasks.microtask(() => console.log('called third'));
tasks.macrotask(() => console.log('called second'));
tasks.synchonouse(() => console.log('called first'));
`Tests
The package is 100% tested on node as well as on safari, firefox and chrome ( using jest the awesome playwright package ).In order to reproduce the tests type the command below:
`
yarn build & yarn test
``