diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2023-12-27 17:10:47 +0100 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2023-12-27 17:10:47 +0100 |
commit | 6e4931c4ad6c1f06cd1e46ecbf98e04cbb8b4ba7 (patch) | |
tree | 8d69d6513520c68d94795084e01859baae527ba0 /quickjs.h | |
parent | 9b587c461b06af06e78070b86d9b99da7d863065 (diff) | |
download | quickjs-6e4931c4ad6c1f06cd1e46ecbf98e04cbb8b4ba7.tar.gz quickjs-6e4931c4ad6c1f06cd1e46ecbf98e04cbb8b4ba7.zip |
top-level-await support - follow the spec in the implementation of the module linking and evaluation to avoid errors with cycling module dependencies
Diffstat (limited to 'quickjs.h')
-rw-r--r-- | quickjs.h | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -831,7 +831,15 @@ typedef struct { void JS_SetSharedArrayBufferFunctions(JSRuntime *rt, const JSSharedArrayBufferFunctions *sf); +typedef enum JSPromiseStateEnum { + JS_PROMISE_PENDING, + JS_PROMISE_FULFILLED, + JS_PROMISE_REJECTED, +} JSPromiseStateEnum; + JSValue JS_NewPromiseCapability(JSContext *ctx, JSValue *resolving_funcs); +JSPromiseStateEnum JS_PromiseState(JSContext *ctx, JSValue promise); +JSValue JS_PromiseResult(JSContext *ctx, JSValue promise); /* is_handled = TRUE means that the rejection is handled */ typedef void JSHostPromiseRejectionTracker(JSContext *ctx, JSValueConst promise, @@ -902,8 +910,8 @@ int JS_ResolveModule(JSContext *ctx, JSValueConst obj); /* only exported for os.Worker() */ JSAtom JS_GetScriptOrModuleName(JSContext *ctx, int n_stack_levels); /* only exported for os.Worker() */ -JSModuleDef *JS_RunModule(JSContext *ctx, const char *basename, - const char *filename); +JSValue JS_LoadModule(JSContext *ctx, const char *basename, + const char *filename); /* C function definition */ typedef enum JSCFunctionEnum { /* XXX: should rename for namespace isolation */ |