diff options
Diffstat (limited to 'lib/monoucha0/monoucha/javascript.nim')
-rw-r--r-- | lib/monoucha0/monoucha/javascript.nim | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/monoucha0/monoucha/javascript.nim b/lib/monoucha0/monoucha/javascript.nim index 14cd95eb..1d61acd3 100644 --- a/lib/monoucha0/monoucha/javascript.nim +++ b/lib/monoucha0/monoucha/javascript.nim @@ -369,12 +369,9 @@ func newJSClass*(ctx: JSContext; cdef: JSClassDefConst; nimt: pointer; ctxOpaque.ctors.add(JS_UNDEFINED) ctxOpaque.ctors[result] = JS_DupValue(ctx, jctor) if not nointerface: - if JS_IsNull(namespace): - doAssert ctx.definePropertyCW(ctxOpaque.global, $cdef.class_name, - jctor) == dprSuccess - else: - doAssert ctx.definePropertyCW(namespace, $cdef.class_name, - jctor) == dprSuccess + let target = if JS_IsNull(namespace): ctxOpaque.global else: namespace + doAssert JS_DefinePropertyValueStr(ctx, target, cdef.class_name, jctor, + JS_PROP_CONFIGURABLE or JS_PROP_WRITABLE) == 1 else: JS_FreeValue(ctx, jctor) |