Neapolitan Pizza Margherita

    mighty-promise
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.8 • Public • Published

    Mighty Promise

    Powerful promise utils collections

    codecov

    Usage

    Install

    yarn add mighty-promise
    # or
    npm i mighty-promise

    Use

    import {Progressive} from 'mighty-promise'
    import {Progressive} from 'https://deno.land/x/mighty_promise@v0.0.6/mod.ts'

    API

    Progressive.map(arr, callback, option)

    map can split a large task on arr to several small tasks. It can be used to prevent heavy calculation from blocking the thread.

    option definition

    interface ProgressiveOptions {
      // in ms
      minInterval?: number;
      // in ms
      maxExecutionDuration?: number;
      useIdleCallback?: boolean;
    }
    Example
    import {map} from 'mighty-promise'
    
    async function tasks(taskInfo: string[]) {
      map(tasks, task => {
        runTask(task);
      }, {maxExecutionDuration: 10})
    }

    Progressive.forEach(arr, callback, option)

    It is the same as map, but the output is ignored.

    Install

    npm i mighty-promise

    DownloadsWeekly Downloads

    3

    Version

    0.0.8

    License

    ISC

    Unpacked Size

    91.7 kB

    Total Files

    159

    Last publish

    Collaborators

    • rem2018