about summary refs log tree commit diff stats
path: root/src/html/catom.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/html/catom.nim')
-rw-r--r--src/html/catom.nim9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/html/catom.nim b/src/html/catom.nim
index 111abb8d..3590bc63 100644
--- a/src/html/catom.nim
+++ b/src/html/catom.nim
@@ -198,7 +198,8 @@ func toStaticAtom*(factory: CAtomFactory; atom: CAtom): StaticAtom =
     return StaticAtom(i)
   return atUnknown
 
-var getFactory*: proc(ctx: JSContext): CAtomFactory {.nimcall, noSideEffect.}
+var getFactory*: proc(ctx: JSContext): CAtomFactory {.nimcall, noSideEffect,
+  raises: [].}
 
 proc toAtom*(ctx: JSContext; atom: StaticAtom): CAtom =
   return ctx.getFactory().toAtom(atom)
@@ -212,6 +213,12 @@ proc fromJS*(ctx: JSContext; val: JSValue; res: var CAtom): Opt[void] =
   res = ctx.getFactory().toAtom(s)
   return ok()
 
+proc fromJS*(ctx: JSContext; val: JSAtom; 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))