| 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 | |
| 8 | module builtin |
| 9 | |
| 10 | // Window |
| 11 | fn JS.atob(string) string |
| 12 | fn JS.btoa(string) string |
| 13 | fn JS.clearInterval(int) |
| 14 | fn 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> |
| 22 | fn JS.queueMicrotask(fn ()) |
| 23 | fn JS.setInterval(any, int, ...any) int |
| 24 | fn JS.setTimeout(any, int, ...any) int |
| 25 | |
| 26 | fn JS.alert(any) |
| 27 | fn JS.blur() |
| 28 | fn JS.captureEvents() |
| 29 | fn JS.close() |
| 30 | fn JS.confirm(string) bool |
| 31 | |
| 32 | // fn JS.departFocus(NavigationReason, FocusNavigationOrigin) |
| 33 | fn 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 |
| 39 | fn JS.moveBy(int, int) |
| 40 | fn JS.moveTo(int, int) |
| 41 | fn JS.msWriteProfilerMark(string) |
| 42 | |
| 43 | // fn JS.open(string, string, string, bool)?Window |
| 44 | // fn JS.postMessage(any, string, []Transferable) |
| 45 | fn JS.print() |
| 46 | fn JS.prompt(string, string) ?string |
| 47 | fn JS.releaseEvents() |
| 48 | fn JS.resizeBy(int, int) |
| 49 | fn JS.resizeTo(int, int) |
| 50 | |
| 51 | // fn JS.scroll(ScrollToOptions) |
| 52 | fn JS.scroll(int, int) |
| 53 | |
| 54 | // fn JS.scrollBy(ScrollToOptions) |
| 55 | fn JS.scrollBy(int, int) |
| 56 | |
| 57 | // fn JS.scrollTo(ScrollToOptions) |
| 58 | fn JS.scrollTo(int, int) |
| 59 | fn JS.stop() |
| 60 | |