diff options
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)), |