1.0.24 • Published 2 years ago

@audi2014/react-async-concurrent v1.0.24

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

react-async-concurrent

GitHub license npm version npm npm.io

npm.io

Dummy package for declarative(JSX) sequential promise execution

...
<Async promiseFn={promiseFn}>{render}</Async> // this promiseFn starts at first
<Async promiseFn={promiseFn}>{render}</Async> // starts after finishing first
<Async promiseFn={promiseFn}>{render}</Async> // starts after finishing seccond
...

Index

Async

Component (wrapper) which will put promise result into children (FaCC) or renderResult function

Props

  • renderPending ({status: pending}) - optional callback for rendering pending status: (promiseFn was not called or canceled. Component is waiting for finishing other concurrent promises)
  • renderProgress ({status: progress}) - optional callback for rendering progress status: (promiseFn was called but promise did not fulfilled yet)
  • renderError ({error, status: error}) - optional callback for rendering error status: (promiseFn promise throws error)
  • promiseFn - function callback that should create new promise. will be called if all child promises resolved. supports cancelable promises such as cancelable-promise
  • children - FaCC with arguments {lastResult/result:"Awaited result of promiseFn", status: pending|progress|error|result} if children is set - renderers renderPending/renderProgress/renderError/renderResult will be ignored
  • asyncStart - do not wait for finishing concurrent promises. call promiseFn immediately
  • asyncChildren - children will have parallel concurrent context
  • awaited - promiseFn will not block other concurrent promises

Example

https://qz8j6h.csb.app/

Example


Bugs

  • React.StrictMode runs all promiseFn at first render in codesandbox env

subpath imports support (ESM/CommonJs)

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.7-alpha.1

3 years ago

1.0.8

3 years ago

1.0.7-alpha.0

3 years ago

1.0.7

3 years ago

1.0.6-alpha.0

3 years ago

1.0.6

3 years ago

1.0.5-alpha.2

3 years ago

1.0.5-alpha

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago