v2 / vlib / builtin / js / jsfns_browser.js.v
59 lines · 47 sloc · 1.67 KB · 763f94388b1ceff59c3e68ebda2c9f57197f32a4
Raw
1// Copyright (c) 2019-2024 Alexander Medvednikov. All rights reserved.
2// Use of this source code is governed by an MIT license
3// that can be found in the LICENSE file.
4
5// This file contains JS functions only present in the browser.
6// They have been ported from their TypeScript definitions.
7
8module builtin
9
10// Window
11fn JS.atob(string) string
12fn JS.btoa(string) string
13fn JS.clearInterval(int)
14fn JS.clearTimeout(int)
15
16// fn JS.createImageBitmap(ImageBitmapSource, ImageBitmapOptions) Promise<ImageBitmap>
17// fn JS.createImageBitmap(ImageBitmapSource, int, int, int, int, ImageBitmapOptions) Promise<ImageBitmap>
18
19// TODO: js async attribute
20// [js_async]
21// fn JS.fetch(RequestInfo, RequestInit) Promise<Response>
22fn JS.queueMicrotask(fn ())
23fn JS.setInterval(any, int, ...any) int
24fn JS.setTimeout(any, int, ...any) int
25
26fn JS.alert(any)
27fn JS.blur()
28fn JS.captureEvents()
29fn JS.close()
30fn JS.confirm(string) bool
31
32// fn JS.departFocus(NavigationReason, FocusNavigationOrigin)
33fn JS.focus()
34
35// fn JS.getComputedStyle(Element, string | null) CSSStyleDeclaration
36// fn JS.getMatchedCSSRules(Element, string | null) CSSRuleList
37// fn JS.getSelection() Selection | null
38// fn JS.matchMedia(string) MediaQueryList
39fn JS.moveBy(int, int)
40fn JS.moveTo(int, int)
41fn JS.msWriteProfilerMark(string)
42
43// fn JS.open(string, string, string, bool)?Window
44// fn JS.postMessage(any, string, []Transferable)
45fn JS.print()
46fn JS.prompt(string, string) ?string
47fn JS.releaseEvents()
48fn JS.resizeBy(int, int)
49fn JS.resizeTo(int, int)
50
51// fn JS.scroll(ScrollToOptions)
52fn JS.scroll(int, int)
53
54// fn JS.scrollBy(ScrollToOptions)
55fn JS.scrollBy(int, int)
56
57// fn JS.scrollTo(ScrollToOptions)
58fn JS.scrollTo(int, int)
59fn JS.stop()
60