about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-08-09 00:29:31 +0200
committerbptato <nincsnevem662@gmail.com>2024-08-09 00:29:31 +0200
commitb6b998bf608f2f82d5b639455b2fd6224b0919e2 (patch)
tree8dd1e2869b64ac584700b6de034db5c667200954 /src/config
parent4c64687290c908cd791a058dede9bd4f2a1c7757 (diff)
downloadchawan-b6b998bf608f2f82d5b639455b2fd6224b0919e2.tar.gz
Update monoucha
Diffstat (limited to 'src/config')
-rw-r--r--src/config/chapath.nim5
-rw-r--r--src/config/config.nim6
2 files changed, 4 insertions, 7 deletions
diff --git a/src/config/chapath.nim b/src/config/chapath.nim
index 8397cb3d..9878e09b 100644
--- a/src/config/chapath.nim
+++ b/src/config/chapath.nim
@@ -4,7 +4,6 @@ import std/posix
 
 import monoucha/fromjs
 import monoucha/javascript
-import monoucha/jserror
 import monoucha/tojs
 import types/opt
 import utils/twtstr
@@ -283,8 +282,8 @@ proc unquote(p: string): ChaPathResult[string] =
 proc toJS*(ctx: JSContext; p: ChaPath): JSValue =
   toJS(ctx, $p)
 
-proc fromJSChaPath*(ctx: JSContext; val: JSValue): JSResult[ChaPath] =
-  return cast[JSResult[ChaPath]](fromJS[string](ctx, val))
+proc fromJS*(ctx: JSContext; val: JSValue; res: var ChaPath): Opt[void] =
+  return ctx.fromJS(val, string(res))
 
 proc unquote*(p: ChaPath): ChaPathResult[string] =
   let s = ?unquote(string(p))
diff --git a/src/config/config.nim b/src/config/config.nim
index 3c733bc5..b0064aa2 100644
--- a/src/config/config.nim
+++ b/src/config/config.nim
@@ -13,7 +13,6 @@ import js/jscolor
 import loader/headers
 import monoucha/fromjs
 import monoucha/javascript
-import monoucha/jserror
 import monoucha/jspropenumlist
 import monoucha/jsregex
 import monoucha/jstypes
@@ -195,9 +194,8 @@ jsDestructor(Config)
 converter toStr*(p: ChaPathResolved): string {.inline.} =
   return string(p)
 
-proc fromJSChaPathResolved(ctx: JSContext; val: JSValue):
-    JSResult[ChaPathResolved] =
-  return cast[JSResult[ChaPathResolved]](fromJS[string](ctx, val))
+proc fromJS(ctx: JSContext; val: JSValue; res: var ChaPathResolved): Opt[void] =
+  return ctx.fromJS(val, string(res))
 
 proc `[]=`(a: var ActionMap; b, c: string) =
   a.t[b] = c