diff options
author | bptato <nincsnevem662@gmail.com> | 2023-04-30 18:59:19 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-04-30 18:59:19 +0200 |
commit | 5db380ff789db24c6c48e2c513d9ca5ac7a606b3 (patch) | |
tree | 9296e1b88d48bf767df49cfbf08c43181da24b44 /src/html | |
parent | c235e638788b43ca752179341e429f4d7e090870 (diff) | |
parent | a02c408f933aea6f405ed3c64ab151b01b33ae9e (diff) | |
download | chawan-5db380ff789db24c6c48e2c513d9ca5ac7a606b3.tar.gz |
Merge branch 'wip_fetch'
Diffstat (limited to 'src/html')
-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)), |