diff options
author | bptato <nincsnevem662@gmail.com> | 2023-08-20 16:01:06 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-08-20 16:50:46 +0200 |
commit | 230ad7876ed5f8f26dce02db0e3528a5539150f4 (patch) | |
tree | a6051dfaeb43ad45e6f92e171328fcf1d5580922 /src/html/env.nim | |
parent | 65ad7f9fc8b69140c050006fbe9ea1644bc283d8 (diff) | |
download | chawan-230ad7876ed5f8f26dce02db0e3528a5539150f4.tar.gz |
javascript: finish LegacyUnforgeable + misc fixes
Add jsuffget, jsuffunc for setting LegacyUnforgeable on functions. Misc fixes: * define LegacyUnforgeable properties for native object shims * replace some macros with templates
Diffstat (limited to 'src/html/env.nim')
-rw-r--r-- | src/html/env.nim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/html/env.nim b/src/html/env.nim index 97f202f9..c38852d5 100644 --- a/src/html/env.nim +++ b/src/html/env.nim @@ -93,6 +93,9 @@ proc setLocation(window: Window, s: string): Err[DOMException] {.jsfset: "location".} = window.document.setLocation(s) +proc getWindow(window: Window): Window {.jsuffget: "window".} = + return window + proc addScripting*(window: Window, selector: Selector[int]) = let rt = newJSRuntime() let ctx = rt.newJSContext() @@ -115,7 +118,6 @@ proc addScripting*(window: Window, selector: Selector[int]) = var global = JS_GetGlobalObject(ctx) ctx.registerType(Window, asglobal = true) ctx.setGlobal(global, window) - ctx.defineProperty(global, "window", global) JS_FreeValue(ctx, global) ctx.addDOMExceptionModule() ctx.addconsoleModule() |