MCPcopy Create free account
hub / github.com/async-library/react-async / start

Method start

packages/react-async/src/Async.tsx:194–205  ·  view source on GitHub ↗
(promiseFn: () => Promise<T>)

Source from the content-addressed store, hash-verified

192 }
193
194 start(promiseFn: () => Promise<T>) {
195 if ("AbortController" in globalScope) {
196 this.abortController.abort()
197 this.abortController = new globalScope.AbortController!()
198 }
199 this.counter++
200 return (this.promise = new Promise((resolve, reject) => {
201 if (!this.mounted) return
202 const executor = () => promiseFn().then(resolve, reject)
203 this.dispatch({ type: ActionTypes.start, payload: executor, meta: this.getMeta() })
204 }))
205 }
206
207 load() {
208 const promise = this.props.promise

Callers 2

loadMethod · 0.95
runMethod · 0.95

Calls 1

getMetaMethod · 0.95

Tested by

no test coverage detected