Chf
Chf is a minimal library for "chunkifying" long-running tasks with ability to be aborted. The main idea is to split such long-running task into small units of work joined into chunks with limited budget of execution time.
Installation
$ npm install chf
Note: Chf requires native Promise
api so if your environment doesn't support them, you will have to install any suitable polyfill as well.
Usage
// with ES6 modules; // with CommonJS modules;
Example
; ; // Run task; // Wait until task has completedpromise.then , ; // Abort task at any time, next chunk of units won't be executedsetTimeouttask.abort, 50;