diff options
author | bptato <nincsnevem662@gmail.com> | 2024-08-09 00:29:31 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-08-09 00:29:31 +0200 |
commit | b6b998bf608f2f82d5b639455b2fd6224b0919e2 (patch) | |
tree | 8dd1e2869b64ac584700b6de034db5c667200954 /src/html/catom.nim | |
parent | 4c64687290c908cd791a058dede9bd4f2a1c7757 (diff) | |
download | chawan-b6b998bf608f2f82d5b639455b2fd6224b0919e2.tar.gz |
Update monoucha
Diffstat (limited to 'src/html/catom.nim')
-rw-r--r-- | src/html/catom.nim | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/html/catom.nim b/src/html/catom.nim index 0ff7b949..111abb8d 100644 --- a/src/html/catom.nim +++ b/src/html/catom.nim @@ -6,7 +6,6 @@ import std/strutils import chame/tags import monoucha/fromjs import monoucha/javascript -import monoucha/jserror import monoucha/tojs import types/opt import utils/twtstr @@ -207,9 +206,11 @@ proc toAtom*(ctx: JSContext; atom: StaticAtom): CAtom = proc toStaticAtom*(ctx: JSContext; atom: CAtom): StaticAtom = return ctx.getFactory().toStaticAtom(atom) -proc fromJSCAtom*(ctx: JSContext; val: JSValue): JSResult[CAtom] = - let s = ?fromJS[string](ctx, val) - return ok(ctx.getFactory().toAtom(s)) +proc fromJS*(ctx: JSContext; val: JSValue; res: var CAtom): Opt[void] = + var s: string + ?ctx.fromJS(val, s) + res = ctx.getFactory().toAtom(s) + return ok() proc toJS*(ctx: JSContext; atom: CAtom): JSValue = return ctx.toJS(ctx.getFactory().toStr(atom)) |