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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    2

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