share-promise

1.0.0 • Public • Published

share-promise

share the async result from a function

Getting started

npm i share-promise

Usage

    let i = 0

    const fn = async () => {
        await delay()
        i++
        return i
    }

    const sfn = share(fn)

    const mmm = await Promise.all([
        sfn(),
        sfn(),
        sfn(),
    ])

    console.log(mmm)

License

MIT

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i share-promise

      Weekly Downloads

      2

      Version

      1.0.0

      License

      ISC

      Unpacked Size

      2.99 kB

      Total Files

      5

      Last publish

      Collaborators

      • fanlia