From e44e5c93f698f5ddf3168cfcc87a4494ad91641d Mon Sep 17 00:00:00 2001 From: bptato Date: Tue, 29 Aug 2023 22:53:25 +0200 Subject: javascript: factor out fromJS --- src/html/chadombuilder.nim | 1 + src/html/dom.nim | 3 ++- src/html/event.nim | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/html') diff --git a/src/html/chadombuilder.nim b/src/html/chadombuilder.nim index ad8f7f36..5ccc7ee2 100644 --- a/src/html/chadombuilder.nim +++ b/src/html/chadombuilder.nim @@ -4,6 +4,7 @@ import streams import html/dom import js/error +import js/fromjs import js/javascript import types/url diff --git a/src/html/dom.nim b/src/html/dom.nim index c0b60728..617ec404 100644 --- a/src/html/dom.nim +++ b/src/html/dom.nim @@ -20,6 +20,7 @@ import io/request import io/window import js/domexception import js/error +import js/fromjs import js/javascript import js/opaque import js/timeout @@ -2943,7 +2944,7 @@ proc jsReflectSet(ctx: JSContext, this, val: JSValue, magic: cint): JSValue {.cd return JS_ThrowTypeError(ctx, "Invalid tag type %s", element.tagType) case entry.t of REFLECT_STR: - let x = toString(ctx, val) + let x = fromJS[string](ctx, val) if x.isSome: element.attr(entry.attrname, x.get) of REFLECT_BOOL: diff --git a/src/html/event.nim b/src/html/event.nim index 0584b230..5f841fd1 100644 --- a/src/html/event.nim +++ b/src/html/event.nim @@ -3,6 +3,7 @@ import times import bindings/quickjs import js/error +import js/fromjs import js/javascript import js/tojs import utils/opt -- cgit 1.4.1-2-gfad0