MCPcopy
hub / github.com/react/create-react-app / invoke

Function invoke

packages/react-error-overlay/fixtures/bundle_u.mjs:19957–19994  ·  view source on GitHub ↗
(method, arg, resolve, reject)

Source from the content-addressed store, hash-verified

19955
19956 function AsyncIterator(generator) {
19957 function invoke(method, arg, resolve, reject) {
19958 var record = tryCatch(generator[method], generator, arg);
19959 if (record.type === "throw") {
19960 reject(record.arg);
19961 } else {
19962 var result = record.arg;
19963 var value = result.value;
19964 if (value &&
19965 typeof value === "object" &&
19966 hasOwn.call(value, "__await")) {
19967 return Promise.resolve(value.__await).then(function(value) {
19968 invoke("next", value, resolve, reject);
19969 }, function(err) {
19970 invoke("throw", err, resolve, reject);
19971 });
19972 }
19973
19974 return Promise.resolve(value).then(function(unwrapped) {
19975 // When a yielded Promise is resolved, its final value becomes
19976 // the .value of the Promise<{value,done}> result for the
19977 // current iteration. If the Promise is rejected, however, the
19978 // result for this iteration will be rejected with the same
19979 // reason. Note that rejections of yielded Promises are not
19980 // thrown back into the generator function, as is the case
19981 // when an awaited Promise is rejected. This difference in
19982 // behavior between yield and await is important, because it
19983 // allows the consumer to decide what to do with the yielded
19984 // rejection (swallow it and continue, manually .throw it back
19985 // into the generator, abandon iteration, whatever). With
19986 // await, by contrast, there is no opportunity to examine the
19987 // rejection reason outside the generator function, so the
19988 // only option is to throw it from the await expression, and
19989 // let the generator function handle the exception.
19990 result.value = unwrapped;
19991 resolve(result);
19992 }, reject);
19993 }
19994 }
19995
19996 if (typeof process === "object" && process.domain) {
19997 invoke = process.domain.bind(invoke);

Callers 1

Calls 3

tryCatchFunction · 0.70
rejectFunction · 0.70
resolveFunction · 0.70

Tested by

no test coverage detected