about summary refs log tree commit diff stats
path: root/src/html/env.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-10-13 17:41:02 +0200
committerbptato <nincsnevem662@gmail.com>2023-10-13 17:42:08 +0200
commit1cfe1655e1ef6f7ae69b9c87731d571e1ef3ca8c (patch)
treef62e05768e4a4205710cb9727b40b8d0cb04f632 /src/html/env.nim
parent9ff482dd8d5b1b252e77712e9418b5b253f4bbf8 (diff)
downloadchawan-1cfe1655e1ef6f7ae69b9c87731d571e1ef3ca8c.tar.gz
Refactor Console
* merge dom.console & client.Console
* move client-specific stuff out of Console (into callbacks when necessary)
Diffstat (limited to 'src/html/env.nim')
-rw-r--r--src/html/env.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/html/env.nim b/src/html/env.nim
index 49f6bba3..24e1482d 100644
--- a/src/html/env.nim
+++ b/src/html/env.nim
@@ -7,6 +7,7 @@ import html/dom
 import html/event
 import io/promise
 import js/base64
+import js/console
 import js/domexception
 import js/error
 import js/intl
@@ -130,7 +131,7 @@ proc addScripting*(window: Window, selector: Selector[int]) =
   ctx.setGlobal(global, window)
   JS_FreeValue(ctx, global)
   ctx.addDOMExceptionModule()
-  ctx.addconsoleModule()
+  ctx.addConsoleModule()
   ctx.addNavigatorModule()
   ctx.addEventModule()
   ctx.addDOMModule()
@@ -150,9 +151,10 @@ proc runJSJobs*(window: Window) =
 proc newWindow*(scripting: bool, selector: Selector[int],
     attrs: WindowAttributes, navigate: proc(url: URL) = nil,
     loader = none(FileLoader)): Window =
+  let err = newFileStream(stderr)
   let window = Window(
     attrs: attrs,
-    console: console(err: newFileStream(stderr)),
+    console: newConsole(err),
     navigator: Navigator(),
     loader: loader,
     settings: EnvironmentSettings(