1
1
package org .scalajs .dom .raw
2
2
3
3
import scala .scalajs .js
4
+ import scala .scalajs .js .|
4
5
import scala .scalajs .js .annotation ._
5
6
import org .scalajs .dom .experimental .cachestorage .CacheStorage
7
+ import org .scalajs .dom .experimental .{RequestInfo , RequestInit , Response }
6
8
7
9
/**
8
10
* The WindowOrWorkerGlobalScope mixin describes several features common to the
@@ -14,7 +16,8 @@ import org.scalajs.dom.experimental.cachestorage.CacheStorage
14
16
* MDN
15
17
*/
16
18
@ js.native
17
- trait WindowOrWorkerGlobalScope extends js.Object {
19
+ trait WindowOrWorkerGlobalScope extends WindowBase64 with WindowTimers {
20
+ import WindowOrWorkerGlobalScope ._
18
21
19
22
/**
20
23
* Returns the CacheStorage object associated with the current context.
@@ -54,4 +57,86 @@ trait WindowOrWorkerGlobalScope extends js.Object {
54
57
* MDN
55
58
*/
56
59
def origin : String = js.native // should be USVString
60
+
61
+ /**
62
+ * Starts the process of fetching a resource from the network.
63
+ *
64
+ * MDN
65
+ */
66
+ def fetch (info : RequestInfo ,
67
+ init : RequestInit = null ): js.Promise [Response ] = js.native
68
+
69
+ /**
70
+ * Enqueues a microtask—a short function to be executed after execution of
71
+ * the JavaScript code completes and control isn't being returned to a
72
+ * JavaScript caller, but before handling callbacks and other tasks.
73
+ *
74
+ * This lets your code run without interfering with other, possibly higher
75
+ * priority, code, but before the browser runtime regains control,
76
+ * potentially depending upon the work you need to complete.
77
+ *
78
+ * MDN
79
+ */
80
+ def queueMicrotask (function : js.Function0 [Any ]): Unit = js.native
81
+
82
+ /**
83
+ * Accepts a variety of different image sources, and returns a Promise which
84
+ * resolves to an ImageBitmap.
85
+ * Optionally the source is cropped to the rectangle of pixels originating at
86
+ * (sx, sy) with width sw, and height sh.
87
+ *
88
+ * MDN
89
+ */
90
+ def createImageBitmap (
91
+ image : CreateImageBitmapInput ): js.Promise [ImageBitmap ] = js.native
92
+
93
+ def createImageBitmap (image : CreateImageBitmapInput ,
94
+ options : CreateImageBitmapOptions ): js.Promise [ImageBitmap ] = js.native
95
+
96
+ def createImageBitmap (image : CreateImageBitmapInput , sx : Double , sy : Double ,
97
+ sw : Double , sh : Double ): js.Promise [ImageBitmap ] = js.native
98
+
99
+ def createImageBitmap (image : CreateImageBitmapInput , sx : Double , sy : Double ,
100
+ sw : Double , sh : Double ,
101
+ options : CreateImageBitmapOptions ): js.Promise [ImageBitmap ] = js.native
102
+ }
103
+
104
+ /**
105
+ * The ImageBitmap interface represents a bitmap image which can be drawn to a
106
+ * <canvas> without undue latency.
107
+ * It can be created from a variety of source objects using the
108
+ * createImageBitmap() factory method.
109
+ * ImageBitmap provides an asynchronous and resource efficient pathway to
110
+ * prepare textures for rendering in WebGL.
111
+ *
112
+ * MDN
113
+ */
114
+ @ js.native
115
+ trait ImageBitmap extends js.Object {
116
+
117
+ /**
118
+ * An unsigned long representing the height, in CSS pixels, of the ImageData.
119
+ */
120
+ def height : Double = js.native
121
+
122
+ /**
123
+ * An unsigned long representing the width, in CSS pixels, of the ImageData.
124
+ */
125
+ def width : Double = js.native
126
+ }
127
+
128
+ trait CreateImageBitmapOptions extends js.Object {
129
+ var imageOrientation : js.UndefOr [String ] = js.undefined
130
+ var premultiplyAlpha : js.UndefOr [String ] = js.undefined
131
+ var colorSpaceConversion : js.UndefOr [String ] = js.undefined
132
+ var resizeWidth : js.UndefOr [Double ] = js.undefined
133
+ var resizeHeight : js.UndefOr [Double ] = js.undefined
134
+ var resizeQuality : js.UndefOr [String ] = js.undefined
135
+ }
136
+
137
+ object WindowOrWorkerGlobalScope {
138
+
139
+ type CreateImageBitmapInput =
140
+ HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | HTMLCanvasElement | Blob | ImageData | ImageBitmap | OffscreenCanvas
141
+
57
142
}
0 commit comments