MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / getPromiseStatus

Function getPromiseStatus

src/lib/console.js:344–369  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

342 }
343
344 function getPromiseStatus(obj) {
345 if (obj.info) return;
346 let status = "pending";
347 let value;
348 let result = obj.then(
349 (val) => {
350 status = "resolved";
351 value = val;
352 },
353 (val) => {
354 status = "rejected";
355 value = val;
356 },
357 );
358
359 Object.defineProperties(result, {
360 "[[PromiseStatus]]": {
361 get: () => status,
362 },
363 "[[PromiseValue]]": {
364 get: () => value,
365 },
366 });
367
368 return result;
369 }
370
371 function getElement(type) {
372 return tag("c-text", {

Callers 1

getBodyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected