Socket
Socket
Sign inDemoInstall

storeon-until

Package Overview
Dependencies
5
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

4

CHANGELOG.md
# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
## 1.0.2
* Readme update.
## 1.0.1

@@ -4,0 +8,0 @@ * Readme update.

2

package.json
{
"name": "storeon-until",
"version": "1.0.1",
"version": "1.0.2",
"description": "Small simple utility for awaiting [Storeon] event occurs",

@@ -5,0 +5,0 @@ "repository": {

@@ -43,17 +43,16 @@ # storeon-until

// awaiting for the ending event
const documentLoadedPromise = await until(store, 'documentLoaded', (_, {id}) => id === 'id1');
// dispatch event
store.dispatch('loadDocument', 'id1');
// waits until async flow will finish
const {id, document} =
await until(store, 'documentLoaded', (_, {id}) => id === 'id1');
const {id, document} = await documentLoadedPromise;
console.log(document);
// we can also await for the state
const statePromise = until(store, '@changed', ({id}) => id === 'id2');
// dispatch event
store.dispatch('loadDocument', 'id2');
// waits until data in state will pass condition
const {id, document} =
await until(store, '@changed', ({id}) => id === 'id2');
const {id, document} = await statePromise;
console.log(document);

@@ -63,2 +62,7 @@

**Caution**
Please notice, that we should always use `until` utility to create promise before the event dispatch
as dispatched event can run synchronously.
### Api

@@ -65,0 +69,0 @@ - `until` - is function which returns promise of requested event data. Params:

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc