An open API service indexing awesome lists of open source software.

https://github.com/okturtles/okturtles.eventqueue

Synchronize asynchronous SBP invocations
https://github.com/okturtles/okturtles.eventqueue

Last synced: 11 months ago
JSON representation

Synchronize asynchronous SBP invocations

Awesome Lists containing this project

README

          

# `okTurtles.eventQueue`

A serial event queue for asynchronous [SBP](https://github.com/okTurtles/sbp-js) invocations.

Use this to ensure asynchronous SBP invocations get invoked serially, one after another, waiting for the previous invocation to finish completely.

Install:

```
$ npm install --save @sbp/okturtles.eventqueue
```

Usage:

```js
import sbp from '@sbp/sbp'
import '@sbp/okturtles.eventQueue'

async function syncronousHandleEvent (event) {
// here the SBP invocation to 'state/vuex/dispatch' will be
// passed to an event queue designated by 'queue1'
const result = await sbp('okTurtles.eventQueue/queueEvent', 'queue1', [
'state/vuex/dispatch', 'handleEvent', event
])
return result
}
```

Registers the following selectors:

- `'okTurtles.eventQueue/queueEvent'`
- `'okTurtles.eventQueue/isWaiting'`
- `'okTurtles.eventQueue/queuedInvocations'`

## History

See [HISTORY.md](HISTORY.md).

## License

[MIT](LICENSE.txt).