diff options
| author | bptato <nincsnevem662@gmail.com> | 2025-02-02 17:02:09 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2025-02-02 18:34:44 +0100 |
| commit | 50d013362893f3f3a0f2a1d232f73508e3933fe0 (patch) | |
| tree | 23cf7f67bb1196f17e296bb275190badd698e4e9 /src/html | |
| parent | 20eb8b870b4062e50e473e959d2af964c33f4e6a (diff) | |
| download | chawan-50d013362893f3f3a0f2a1d232f73508e3933fe0.tar.gz | |
javascript: derive ctor functions from parent ctor functions
no idea why JS_NewCFunction3 is not public...
Diffstat (limited to 'src/html')
| -rw-r--r-- | src/html/script.nim | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/html/script.nim b/src/html/script.nim index 65601d9c..6ee89da2 100644 --- a/src/html/script.nim +++ b/src/html/script.nim @@ -175,12 +175,11 @@ func uninitIfNull*(val: JSValue): JSValue = proc defineConsts*(ctx: JSContext; classid: JSClassID; consts: typedesc[enum]) = let proto = JS_GetClassProto(ctx, classid) - let ctorProto = JS_GetPrototype(ctx, ctx.getOpaque().ctors[classid]) + let ctor = ctx.getOpaque().ctors[classid] #TODO it should be enough to define on the proto only, but apparently # it isn't... for e in consts: let s = $e ctx.definePropertyE(proto, s, uint16(e)) - ctx.definePropertyE(ctorProto, s, uint16(e)) - JS_FreeValue(ctx, ctorProto) + ctx.definePropertyE(ctor, s, uint16(e)) JS_FreeValue(ctx, proto) |