diff options
author | bptato <nincsnevem662@gmail.com> | 2023-04-30 12:19:24 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-04-30 12:19:24 +0200 |
commit | a02c408f933aea6f405ed3c64ab151b01b33ae9e (patch) | |
tree | 4946f6b13da782a92a1ecc0f03402abacf2614b3 /src/html/env.nim | |
parent | 05b64a1d8fa95381d756231f665c0b8c79787b67 (diff) | |
download | chawan-a02c408f933aea6f405ed3c64ab151b01b33ae9e.tar.gz |
WIP fetch
Diffstat (limited to 'src/html/env.nim')
-rw-r--r-- | src/html/env.nim | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/html/env.nim b/src/html/env.nim index 7f270e58..58bad005 100644 --- a/src/html/env.nim +++ b/src/html/env.nim @@ -3,6 +3,8 @@ import streams import html/dom import html/htmlparser import io/loader +import io/promise +import io/request import js/javascript import types/url @@ -51,6 +53,10 @@ proc addNavigatorModule(ctx: JSContext) = ctx.registerType(PluginArray) ctx.registerType(MimeTypeArray) +proc fetch(window: Window, req: Request): Promise[Response] {.jsfunc.} = + if window.loader.isSome: + return window.loader.get.fetch(req) + proc newWindow*(scripting: bool, loader = none(FileLoader)): Window = result = Window( console: console(err: newFileStream(stderr)), |