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-25 14:16:01 +0200
committerbptato <nincsnevem662@gmail.com>2023-10-25 14:16:01 +0200
commit80ff0251133d20a11d2ab428ac6f27aa14c45782 (patch)
tree535c9e84c497ae7ed9b0e5642807744d0f6bd758 /src/html/env.nim
parent10bdd58bbe9f3736bbb3f73d2c500740724b696f (diff)
downloadchawan-80ff0251133d20a11d2ab428ac6f27aa14c45782.tar.gz
window: inherit from EventTarget
Diffstat (limited to 'src/html/env.nim')
-rw-r--r--src/html/env.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/html/env.nim b/src/html/env.nim
index 0543a60c..694b09cf 100644
--- a/src/html/env.nim
+++ b/src/html/env.nim
@@ -130,13 +130,14 @@ proc addScripting*(window: Window, selector: Selector[int]) =
     )
   )
   var global = JS_GetGlobalObject(ctx)
-  ctx.registerType(Window, asglobal = true)
+  ctx.addEventModule()
+  let eventTargetCID = ctx.getClass("EventTarget")
+  ctx.registerType(Window, asglobal = true, parent = eventTargetCID)
   ctx.setGlobal(global, window)
   JS_FreeValue(ctx, global)
   ctx.addDOMExceptionModule()
   ctx.addConsoleModule()
   ctx.addNavigatorModule()
-  ctx.addEventModule()
   ctx.addDOMModule()
   ctx.addURLModule()
   ctx.addHTMLModule()