1.0.24 • Published 1 year ago

@audi2014/react-async-concurrent v1.0.24

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year 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

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.7-alpha.1

1 year ago

1.0.8

1 year ago

1.0.7-alpha.0

1 year ago

1.0.7

1 year ago

1.0.6-alpha.0

1 year ago

1.0.6

1 year ago

1.0.5-alpha.2

1 year ago

1.0.5-alpha

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago