about summary refs log tree commit diff stats
path: root/src/bindings
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-12-31 02:14:34 +0100
committerbptato <nincsnevem662@gmail.com>2022-12-31 02:14:34 +0100
commit80b45c0df3f5bbbedb9abfb02fdef608113958e1 (patch)
tree475cd89df09b4147b8ee6ce9a1ec28954eb6dc30 /src/bindings
parent310254b09ee2dd3045648848ca9f60f9f1f7c769 (diff)
downloadchawan-80b45c0df3f5bbbedb9abfb02fdef608113958e1.tar.gz
Add promise support to JS
Diffstat (limited to 'src/bindings')
-rw-r--r--src/bindings/quickjs.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bindings/quickjs.nim b/src/bindings/quickjs.nim
index b5aeaf37..6dbc1f2d 100644
--- a/src/bindings/quickjs.nim
+++ b/src/bindings/quickjs.nim
@@ -97,6 +97,7 @@ type
   JSClassFinalizer* = proc (rt: JSRuntime, val: JSValue) {.cdecl.}
   JSClassGCMark* = proc (rt: JSRuntime, val: JSValue, mark_func: JS_MarkFunc) {.cdecl.}
   JS_MarkFunc* = proc (rt: JSRuntime, gp: ptr JSGCObjectHeader) {.cdecl.}
+  JSJobFunc* = proc (ctx: JSContext, argc: cint, argv: ptr JSValue): JSValue
   JSGCObjectHeader* {.importc, header: qjsheader.} = object
 
   JSPropertyDescriptor* {.importc, header: qjsheader.} = object
@@ -312,6 +313,7 @@ proc JS_NewObject*(ctx: JSContext): JSValue
 proc JS_NewObjectClass*(ctx: JSContext, class_id: JSClassID): JSValue
 proc JS_NewObjectProto*(ctx: JSContext, proto: JSValue): JSValue
 proc JS_NewObjectProtoClass*(ctx: JSContext, proto: JSValue, class_id: JSClassID): JSValue
+proc JS_NewPromiseCapability*(ctx: JSContext, resolving_funcs: ptr JSValue): JSValue
 proc JS_SetOpaque*(obj: JSValue, opaque: pointer)
 proc JS_GetOpaque*(obj: JSValue, class_id: JSClassID): pointer
 proc JS_GetOpaque2*(ctx: JSContext, obj: JSValue, class_id: JSClassID): pointer
@@ -416,6 +418,10 @@ proc JS_ThrowReferenceError*(ctx: JSContext, fmt: cstring): JSValue {.varargs, d
 proc JS_ThrowRangeError*(ctx: JSContext, fmt: cstring): JSValue {.varargs, discardable.}
 proc JS_ThrowInternalError*(ctx: JSContext, fmt: cstring): JSValue {.varargs, discardable.}
 
+proc JS_EnqueueJob*(ctx: JSContext, job_func: JSJobFunc, argc: cint, argv: ptr JSValue): cint
+proc JS_IsJobPending*(rt: JSRuntime): JS_BOOL
+proc JS_ExecutePendingJob*(rt: JSRuntime, pctx: ptr JSContext): cint
+
 proc JS_GetRuntimeOpaque*(rt: JSRuntime): pointer
 proc JS_SetRuntimeOpaque*(rt: JSRuntime, p: pointer)