MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxLoadModulesPromise

Function fxLoadModulesPromise

xs/sources/xsModule.c:1035–1066  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1033}
1034
1035void fxLoadModulesPromise(txMachine* the, txSlot* queue, txSlot* module, txSlot* promise, txCallback fulfilled, txCallback rejected)
1036{
1037 txSlot* function;
1038 txSlot* home;
1039 txSlot* resolveLoadFunction;
1040 txSlot* rejectLoadFunction;
1041
1042 mxPushUndefined();
1043 mxPush(mxPromiseConstructor);
1044 mxPushSlot(promise);
1045 fx_Promise_resolveAux(the);
1046 mxPop();
1047 mxPop();
1048 promise = the->stack;
1049
1050 function = fxNewHostFunction(the, fulfilled, 1, XS_NO_ID, mxLoadModulesFulfilledProfileID);
1051 home = mxFunctionInstanceHome(function);
1052 home->value.home.object = queue;
1053 home->value.home.module = module->value.reference;
1054 resolveLoadFunction = the->stack;
1055
1056 function = fxNewHostFunction(the, rejected, 1, XS_NO_ID, mxLoadModulesRejectedProfileID);
1057 home = mxFunctionInstanceHome(function);
1058 home->value.home.object = queue;
1059 home->value.home.module = module->value.reference;
1060 rejectLoadFunction = the->stack;
1061
1062 fxPromiseThen(the, promise->value.reference, resolveLoadFunction, rejectLoadFunction, C_NULL, C_NULL);
1063
1064 mxPop();
1065 mxPop();
1066}
1067
1068void fxLoadModules(txMachine* the, txSlot* queue)
1069{

Callers 2

fxLoadModulesFunction · 0.85
fxImportModuleStuffFunction · 0.85

Calls 3

fx_Promise_resolveAuxFunction · 0.85
fxNewHostFunctionFunction · 0.85
fxPromiseThenFunction · 0.85

Tested by

no test coverage detected