|
| 1 | +package org.scalajs.dom.raw |
| 2 | + |
| 3 | +import org.scalajs.dom.experimental.{RequestInfo, RequestInit, Response} |
| 4 | + |
| 5 | +import scala.scalajs.js |
| 6 | +import scala.scalajs.js.| |
| 7 | + |
| 8 | +@js.native |
| 9 | +trait WindowOrWorkerGlobalScope extends js.Object { |
| 10 | + |
| 11 | + def caches: js.Any = js.native |
| 12 | + def crossOriginIsolated: Boolean = js.native |
| 13 | + def isSecureContext: Boolean = js.native |
| 14 | + def origin: String = js.native |
| 15 | + |
| 16 | + type indexedDB = org.scalajs.dom.raw.IDBFactory |
| 17 | + |
| 18 | + /** |
| 19 | + * Starts the process of fetching a resource from the network. |
| 20 | + * |
| 21 | + * MDN |
| 22 | + */ |
| 23 | + def fetch(info: RequestInfo, |
| 24 | + init: RequestInit = null): js.Promise[Response] = js.native |
| 25 | + |
| 26 | + /** |
| 27 | + * Enqueues a microtask—a short function to be executed after execution of |
| 28 | + * the JavaScript code completes and control isn't being returned to a |
| 29 | + * JavaScript caller, but before handling callbacks and other tasks. |
| 30 | + * |
| 31 | + * This lets your code run without interfering with other, possibly higher |
| 32 | + * priority, code, but before the browser runtime regains control, |
| 33 | + * potentially depending upon the work you need to complete. |
| 34 | + * |
| 35 | + * MDN |
| 36 | + */ |
| 37 | + def queueMicrotask(function: js.Function): Unit = js.native |
| 38 | + |
| 39 | + /** |
| 40 | + * Creates a base-64 encoded ASCII string from a "string" of binary data. |
| 41 | + */ |
| 42 | + def btoa(rawString: String): String = js.native |
| 43 | + |
| 44 | + /** |
| 45 | + * Decodes a string of data which has been encoded using base-64 encoding. |
| 46 | + */ |
| 47 | + def atob(encodedString: String): String = js.native |
| 48 | + |
| 49 | + /** |
| 50 | + * Clears the delay set by window.setTimeout(). |
| 51 | + * |
| 52 | + * MDN |
| 53 | + */ |
| 54 | + def clearTimeout(handle: Int): Unit = js.native |
| 55 | + |
| 56 | + /** |
| 57 | + * Calls a function or executes a code snippet after a specified delay. |
| 58 | + * |
| 59 | + * MDN |
| 60 | + */ |
| 61 | + def setTimeout(handler: js.Function0[Any], timeout: Double): Int = js.native |
| 62 | + |
| 63 | + /** |
| 64 | + * Cancels repeated action which was set up using setInterval. |
| 65 | + * |
| 66 | + * MDN |
| 67 | + */ |
| 68 | + def clearInterval(handle: Int): Unit = js.native |
| 69 | + |
| 70 | + /** |
| 71 | + * Calls a function or executes a code snippet repeatedly, with a fixed time |
| 72 | + * delay between each call to that function. |
| 73 | + * |
| 74 | + * MDN |
| 75 | + */ |
| 76 | + def setInterval(handler: js.Function0[Any], timeout: Double): Int = js.native |
| 77 | + |
| 78 | + /** |
| 79 | + * Accepts a variety of different image sources, and returns a Promise which |
| 80 | + * resolves to an ImageBitmap. |
| 81 | + * Optionally the source is cropped to the rectangle of pixels originating at |
| 82 | + * (sx, sy) with width sw, and height sh. |
| 83 | + * |
| 84 | + * MDN |
| 85 | + */ |
| 86 | + def createImageBitmap( |
| 87 | + image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | HTMLCanvasElement | Blob | ImageData | ImageBitmap | OffscreenCanvas): js.Promise[ImageBitmap] = js.native |
| 88 | + def createImageBitmap( |
| 89 | + image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | HTMLCanvasElement | Blob | ImageData | ImageBitmap | OffscreenCanvas, |
| 90 | + options: CreateImageBitmapOption): js.Promise[ImageBitmap] = js.native |
| 91 | + def createImageBitmap( |
| 92 | + image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | HTMLCanvasElement | Blob | ImageData | ImageBitmap | OffscreenCanvas, |
| 93 | + sx: Double, sy: Double, sw: Double, |
| 94 | + sh: Double): js.Promise[ImageBitmap] = js.native |
| 95 | + def createImageBitmap( |
| 96 | + image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | HTMLCanvasElement | Blob | ImageData | ImageBitmap | OffscreenCanvas, |
| 97 | + sx: Double, sy: Double, sw: Double, sh: Double, |
| 98 | + options: CreateImageBitmapOption): js.Promise[ImageBitmap] = js.native |
| 99 | +} |
| 100 | + |
| 101 | +trait CreateImageBitmapOption extends js.Object { |
| 102 | + var imageOrientation: js.UndefOr[String] = js.undefined |
| 103 | + |
| 104 | + var premultiplyAlpha: js.UndefOr[String] = js.undefined |
| 105 | + |
| 106 | + var colorSpaceConversion: js.UndefOr[String] = js.undefined |
| 107 | + |
| 108 | + var resizeWidth: js.UndefOr[Double] = js.undefined |
| 109 | + |
| 110 | + var resizeHeight: js.UndefOr[Double] = js.undefined |
| 111 | + |
| 112 | + var resizeQuality: js.UndefOr[String] = js.undefined |
| 113 | +} |
| 114 | + |
| 115 | +/** |
| 116 | + * The ImageBitmap interface represents a bitmap image which can be drawn to a |
| 117 | + * <canvas> without undue latency. |
| 118 | + * It can be created from a variety of source objects using the |
| 119 | + * createImageBitmap() factory method. |
| 120 | + * ImageBitmap provides an asynchronous and resource efficient pathway to |
| 121 | + * prepare textures for rendering in WebGL. |
| 122 | + * |
| 123 | + * MDN |
| 124 | + */ |
| 125 | +@js.native |
| 126 | +trait ImageBitmap extends js.Object { |
| 127 | + |
| 128 | + /** |
| 129 | + * An unsigned long representing the height, in CSS pixels, of the ImageData. |
| 130 | + */ |
| 131 | + def height: Double = js.native |
| 132 | + |
| 133 | + /** |
| 134 | + * An unsigned long representing the width, in CSS pixels, of the ImageData. |
| 135 | + */ |
| 136 | + def width: Double = js.native |
| 137 | +} |
0 commit comments