0.2.2 • Published 5 years ago

my-async-store v0.2.2

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

my-async-store

Build Status npm module Coverage Status Dependency Status

Introduction

There is a case that we have many asynchronous functions need to call, and they are probably in different files.

And we need to know the state of them.

That's a little trouble and this library make it simplify.

Install

Install either in node or browser as you like.

npm i -D 'my-async-store'

or

yarn add -D 'my-async-store'

or

<script src="./dist/my-async-store.umd.js"></script>

Usage

in node:

const { set, wait } = require('my-async-store')

or

import { set, wait } from 'my-async-store'

or in browser:

const { set, wait } = MyAsyncStore

Then

// foo.js
setTimeout(() => {
  console.log('foo is ready')
  set('foo')
}, 10)
// bar.js
setTimeout(() => {
  console.log('bar is ready')
  set('bar')
}, 20)
// hello.js
wait('foo', 'bar').then(() => console.log('everyone is ready!'))

and console will logs

// foo is ready
// bar is ready
// everyone is ready!

That's all!

Documentation

Further usage see API documentation.

Changelog see Changelog.

And here is the recap of Internal Implementation.

0.2.2

5 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.2.0-beta.0

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago