@wailsio/runtime 3.0.0-alpha.20 → 3.0.0-alpha.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/docs/{functions/Window.Size.html → assets/icons.js} +15 -2
  2. package/docs/assets/icons.svg +1 -0
  3. package/docs/assets/main.js +4 -4
  4. package/docs/assets/navigation.js +1 -1
  5. package/docs/assets/search.js +1 -1
  6. package/docs/assets/style.css +2 -1
  7. package/docs/classes/Events.WailsEvent.html +4 -4
  8. package/docs/functions/Application.Hide.html +2 -2
  9. package/docs/functions/Application.Quit.html +2 -2
  10. package/docs/functions/Application.Show.html +2 -2
  11. package/docs/functions/Browser.OpenURL.html +3 -3
  12. package/docs/functions/Call.ByID.html +4 -4
  13. package/docs/functions/Call.ByName.html +4 -4
  14. package/docs/functions/Call.Call.html +3 -3
  15. package/docs/functions/Call.Plugin.html +5 -5
  16. package/docs/functions/Clipboard.SetText.html +3 -3
  17. package/docs/functions/Clipboard.Text.html +2 -2
  18. package/docs/functions/Dialogs.Error.html +2 -2
  19. package/docs/functions/Dialogs.Info.html +2 -2
  20. package/docs/functions/Dialogs.OpenFile.html +2 -2
  21. package/docs/functions/Dialogs.Question.html +2 -2
  22. package/docs/functions/Dialogs.SaveFile.html +2 -2
  23. package/docs/functions/Dialogs.Warning.html +2 -2
  24. package/docs/functions/Events.Emit.html +3 -3
  25. package/docs/functions/Events.Off.html +4 -4
  26. package/docs/functions/Events.OffAll.html +2 -2
  27. package/docs/functions/Events.On.html +4 -4
  28. package/docs/functions/Events.OnMultiple.html +5 -5
  29. package/docs/functions/Events.Once.html +4 -4
  30. package/docs/functions/Events.setup.html +1 -1
  31. package/docs/functions/Flags.GetFlag.html +3 -3
  32. package/docs/functions/Screens.GetAll.html +3 -3
  33. package/docs/functions/Screens.GetCurrent.html +3 -3
  34. package/docs/functions/Screens.GetPrimary.html +3 -3
  35. package/docs/functions/System.Capabilities.html +2 -2
  36. package/docs/functions/System.Environment.html +2 -2
  37. package/docs/functions/System.IsAMD64.html +2 -2
  38. package/docs/functions/System.IsARM.html +2 -2
  39. package/docs/functions/System.IsARM64.html +2 -2
  40. package/docs/functions/System.IsDarkMode.html +2 -2
  41. package/docs/functions/System.IsDebug.html +1 -1
  42. package/docs/functions/System.IsLinux.html +2 -2
  43. package/docs/functions/System.IsMac.html +2 -2
  44. package/docs/functions/System.IsWindows.html +2 -2
  45. package/docs/functions/System.invoke.html +1 -1
  46. package/docs/functions/WML.Enable.html +2 -0
  47. package/docs/functions/WML.Reload.html +2 -2
  48. package/docs/index.html +2 -2
  49. package/docs/interfaces/Dialogs.Button.html +7 -7
  50. package/docs/interfaces/Dialogs.FileFilter.html +5 -5
  51. package/docs/interfaces/Dialogs.MessageDialogOptions.html +9 -9
  52. package/docs/interfaces/Dialogs.OpenFileDialogOptions.html +33 -33
  53. package/docs/interfaces/Dialogs.SaveFileDialogOptions.html +35 -35
  54. package/docs/interfaces/Screens.Position.html +5 -5
  55. package/docs/interfaces/Screens.Rect.html +9 -9
  56. package/docs/interfaces/Screens.Screen.html +19 -19
  57. package/docs/interfaces/Screens.Size.html +5 -5
  58. package/docs/interfaces/System.EnvironmentInfo.html +11 -5
  59. package/docs/interfaces/System.OSInfo.html +9 -0
  60. package/docs/modules/Application.html +4 -4
  61. package/docs/modules/Browser.html +2 -2
  62. package/docs/modules/Call.html +5 -5
  63. package/docs/modules/Clipboard.html +3 -3
  64. package/docs/modules/Dialogs.html +12 -12
  65. package/docs/modules/Events.html +10 -10
  66. package/docs/modules/Flags.html +2 -2
  67. package/docs/modules/Screens.html +8 -9
  68. package/docs/modules/System.html +14 -13
  69. package/docs/modules/WML.html +3 -2
  70. package/docs/modules.html +12 -12
  71. package/docs/variables/Events.Types.html +1 -1
  72. package/docs/variables/Window.html +2 -0
  73. package/package.json +34 -31
  74. package/src/application.js +46 -46
  75. package/src/browser.js +24 -24
  76. package/src/calls.js +180 -161
  77. package/src/clipboard.js +35 -35
  78. package/src/contextmenu.js +97 -97
  79. package/src/dialogs.js +200 -200
  80. package/src/drag.js +119 -125
  81. package/src/event_types.js +5 -0
  82. package/src/events.js +140 -140
  83. package/src/flags.js +25 -25
  84. package/src/index.js +46 -95
  85. package/src/runtime.js +123 -122
  86. package/src/screens.js +77 -83
  87. package/src/system.js +128 -117
  88. package/src/utils.js +86 -0
  89. package/src/window.js +638 -316
  90. package/src/wml.js +250 -171
  91. package/tsconfig.json +19 -19
  92. package/types/event_types.d.ts +5 -0
  93. package/types/events.d.ts +5 -0
  94. package/types/index.d.ts +2 -2
  95. package/types/runtime.d.ts +1 -0
  96. package/types/screens.d.ts +1 -5
  97. package/types/system.d.ts +44 -4
  98. package/types/utils.d.ts +14 -0
  99. package/types/window.d.ts +400 -133
  100. package/types/wml.d.ts +6 -0
  101. package/docs/functions/Window.Center.html +0 -2
  102. package/docs/functions/Window.Close.html +0 -2
  103. package/docs/functions/Window.Fullscreen.html +0 -2
  104. package/docs/functions/Window.Get.html +0 -6
  105. package/docs/functions/Window.GetZoomLevel.html +0 -2
  106. package/docs/functions/Window.Height.html +0 -2
  107. package/docs/functions/Window.Hide.html +0 -2
  108. package/docs/functions/Window.Maximise.html +0 -2
  109. package/docs/functions/Window.Minimise.html +0 -2
  110. package/docs/functions/Window.RelativePosition.html +0 -2
  111. package/docs/functions/Window.Restore.html +0 -2
  112. package/docs/functions/Window.Screen-1.html +0 -2
  113. package/docs/functions/Window.SetAlwaysOnTop.html +0 -3
  114. package/docs/functions/Window.SetBackgroundColour.html +0 -6
  115. package/docs/functions/Window.SetMaxSize.html +0 -4
  116. package/docs/functions/Window.SetMinSize.html +0 -4
  117. package/docs/functions/Window.SetRelativePosition.html +0 -4
  118. package/docs/functions/Window.SetResizable.html +0 -3
  119. package/docs/functions/Window.SetSize.html +0 -4
  120. package/docs/functions/Window.SetTitle.html +0 -3
  121. package/docs/functions/Window.SetZoomLevel.html +0 -3
  122. package/docs/functions/Window.Show.html +0 -2
  123. package/docs/functions/Window.ToggleMaximise.html +0 -2
  124. package/docs/functions/Window.UnMaximise.html +0 -2
  125. package/docs/functions/Window.UnMinimise.html +0 -2
  126. package/docs/functions/Window.Width.html +0 -2
  127. package/docs/functions/Window.ZoomIn.html +0 -2
  128. package/docs/functions/Window.ZoomOut.html +0 -2
  129. package/docs/functions/Window.ZoomReset.html +0 -2
  130. package/docs/modules/Window.html +0 -32
  131. package/docs/types/Screens.Rotation.html +0 -2
  132. package/src/log.js +0 -13
package/src/window.js CHANGED
@@ -1,316 +1,638 @@
1
- /*
2
- _ __ _ __
3
- | | / /___ _(_) /____
4
- | | /| / / __ `/ / / ___/
5
- | |/ |/ / /_/ / / (__ )
6
- |__/|__/\__,_/_/_/____/
7
- The electron alternative for Go
8
- (c) Lea Anthony 2019-present
9
- */
10
-
11
- /* jshint esversion: 9 */
12
-
13
- // Import screen jsdoc definition from ./screens.js
14
- /**
15
- * @typedef {import("./screens").Screen} Screen
16
- */
17
-
18
- import {newRuntimeCallerWithID, objectNames} from "./runtime";
19
-
20
- const center = 0;
21
- const setTitle = 1;
22
- const fullscreen = 2;
23
- const unFullscreen = 3;
24
- const setSize = 4;
25
- const size = 5;
26
- const setMaxSize = 6;
27
- const setMinSize = 7;
28
- const setAlwaysOnTop = 8;
29
- const setRelativePosition = 9;
30
- const relativePosition = 10;
31
- const screen = 11;
32
- const hide = 12;
33
- const maximise = 13;
34
- const unMaximise = 14;
35
- const toggleMaximise = 15;
36
- const minimise = 16;
37
- const unMinimise = 17;
38
- const restore = 18;
39
- const show = 19;
40
- const close = 20;
41
- const setBackgroundColour = 21;
42
- const setResizable = 22;
43
- const width = 23;
44
- const height = 24;
45
- const zoomIn = 25;
46
- const zoomOut = 26;
47
- const zoomReset = 27;
48
- const getZoomLevel = 28;
49
- const setZoomLevel = 29;
50
-
51
- const thisWindow = Get('');
52
-
53
- function createWindow(call) {
54
- return {
55
- Get: (windowName) => createWindow(newRuntimeCallerWithID(objectNames.Window, windowName)),
56
- Center: () => call(center),
57
- SetTitle: (title) => call(setTitle, {title}),
58
- Fullscreen: () => call(fullscreen),
59
- UnFullscreen: () => call(unFullscreen),
60
- SetSize: (width, height) => call(setSize, {width, height}),
61
- Size: () => call(size),
62
- SetMaxSize: (width, height) => call(setMaxSize, {width, height}),
63
- SetMinSize: (width, height) => call(setMinSize, {width, height}),
64
- SetAlwaysOnTop: (onTop) => call(setAlwaysOnTop, {alwaysOnTop: onTop}),
65
- SetRelativePosition: (x, y) => call(setRelativePosition, {x, y}),
66
- RelativePosition: () => call(relativePosition),
67
- Screen: () => call(screen),
68
- Hide: () => call(hide),
69
- Maximise: () => call(maximise),
70
- UnMaximise: () => call(unMaximise),
71
- ToggleMaximise: () => call(toggleMaximise),
72
- Minimise: () => call(minimise),
73
- UnMinimise: () => call(unMinimise),
74
- Restore: () => call(restore),
75
- Show: () => call(show),
76
- Close: () => call(close),
77
- SetBackgroundColour: (r, g, b, a) => call(setBackgroundColour, {r, g, b, a}),
78
- SetResizable: (resizable) => call(setResizable, {resizable}),
79
- Width: () => call(width),
80
- Height: () => call(height),
81
- ZoomIn: () => call(zoomIn),
82
- ZoomOut: () => call(zoomOut),
83
- ZoomReset: () => call(zoomReset),
84
- GetZoomLevel: () => call(getZoomLevel),
85
- SetZoomLevel: (zoomLevel) => call(setZoomLevel, {zoomLevel}),
86
- };
87
- }
88
-
89
- /**
90
- * Gets the specified window.
91
- *
92
- * @param {string} windowName - The name of the window to get.
93
- * @return {Object} - The specified window object.
94
- */
95
- export function Get(windowName) {
96
- return createWindow(newRuntimeCallerWithID(objectNames.Window, windowName));
97
- }
98
-
99
- /**
100
- * Centers the window on the screen.
101
- */
102
- export function Center() {
103
- thisWindow.Center();
104
- }
105
-
106
- /**
107
- * Sets the title of the window.
108
- * @param {string} title - The title to set.
109
- */
110
- export function SetTitle(title) {
111
- thisWindow.SetTitle(title);
112
- }
113
-
114
- /**
115
- * Sets the window to fullscreen.
116
- */
117
- export function Fullscreen() {
118
- thisWindow.Fullscreen();
119
- }
120
-
121
- /**
122
- * Sets the size of the window.
123
- * @param {number} width - The width of the window.
124
- * @param {number} height - The height of the window.
125
- */
126
- export function SetSize(width, height) {
127
- thisWindow.SetSize(width, height);
128
- }
129
-
130
- /**
131
- * Gets the size of the window.
132
- */
133
- export function Size() {
134
- return thisWindow.Size();
135
- }
136
-
137
- /**
138
- * Sets the maximum size of the window.
139
- * @param {number} width - The maximum width of the window.
140
- * @param {number} height - The maximum height of the window.
141
- */
142
- export function SetMaxSize(width, height) {
143
- thisWindow.SetMaxSize(width, height);
144
- }
145
-
146
- /**
147
- * Sets the minimum size of the window.
148
- * @param {number} width - The minimum width of the window.
149
- * @param {number} height - The minimum height of the window.
150
- */
151
- export function SetMinSize(width, height) {
152
- thisWindow.SetMinSize(width, height);
153
- }
154
-
155
- /**
156
- * Sets the window to always be on top.
157
- * @param {boolean} onTop - Whether the window should always be on top.
158
- */
159
- export function SetAlwaysOnTop(onTop) {
160
- thisWindow.SetAlwaysOnTop(onTop);
161
- }
162
-
163
- /**
164
- * Sets the relative position of the window.
165
- * @param {number} x - The x-coordinate of the window's position.
166
- * @param {number} y - The y-coordinate of the window's position.
167
- */
168
- export function SetRelativePosition(x, y) {
169
- thisWindow.SetRelativePosition(x, y);
170
- }
171
-
172
- /**
173
- * Gets the relative position of the window.
174
- */
175
- export function RelativePosition() {
176
- return thisWindow.RelativePosition();
177
- }
178
-
179
- /**
180
- * Gets the screen that the window is on.
181
- */
182
- export function Screen() {
183
- return thisWindow.Screen();
184
- }
185
-
186
- /**
187
- * Hides the window.
188
- */
189
- export function Hide() {
190
- thisWindow.Hide();
191
- }
192
-
193
- /**
194
- * Maximises the window.
195
- */
196
- export function Maximise() {
197
- thisWindow.Maximise();
198
- }
199
-
200
- /**
201
- * Un-maximises the window.
202
- */
203
- export function UnMaximise() {
204
- thisWindow.UnMaximise();
205
- }
206
-
207
- /**
208
- * Toggles the maximisation of the window.
209
- */
210
- export function ToggleMaximise() {
211
- thisWindow.ToggleMaximise();
212
- }
213
-
214
- /**
215
- * Minimises the window.
216
- */
217
- export function Minimise() {
218
- thisWindow.Minimise();
219
- }
220
-
221
- /**
222
- * Un-minimises the window.
223
- */
224
- export function UnMinimise() {
225
- thisWindow.UnMinimise();
226
- }
227
-
228
- /**
229
- * Restores the window.
230
- */
231
- export function Restore() {
232
- thisWindow.Restore();
233
- }
234
-
235
- /**
236
- * Shows the window.
237
- */
238
- export function Show() {
239
- thisWindow.Show();
240
- }
241
-
242
- /**
243
- * Closes the window.
244
- */
245
- export function Close() {
246
- thisWindow.Close();
247
- }
248
-
249
- /**
250
- * Sets the background colour of the window.
251
- * @param {number} r - The red component of the colour.
252
- * @param {number} g - The green component of the colour.
253
- * @param {number} b - The blue component of the colour.
254
- * @param {number} a - The alpha component of the colour.
255
- */
256
- export function SetBackgroundColour(r, g, b, a) {
257
- thisWindow.SetBackgroundColour(r, g, b, a);
258
- }
259
-
260
- /**
261
- * Sets whether the window is resizable.
262
- * @param {boolean} resizable - Whether the window should be resizable.
263
- */
264
- export function SetResizable(resizable) {
265
- thisWindow.SetResizable(resizable);
266
- }
267
-
268
- /**
269
- * Gets the width of the window.
270
- */
271
- export function Width() {
272
- return thisWindow.Width();
273
- }
274
-
275
- /**
276
- * Gets the height of the window.
277
- */
278
- export function Height() {
279
- return thisWindow.Height();
280
- }
281
-
282
- /**
283
- * Zooms in the window.
284
- */
285
- export function ZoomIn() {
286
- thisWindow.ZoomIn();
287
- }
288
-
289
- /**
290
- * Zooms out the window.
291
- */
292
- export function ZoomOut() {
293
- thisWindow.ZoomOut();
294
- }
295
-
296
- /**
297
- * Resets the zoom of the window.
298
- */
299
- export function ZoomReset() {
300
- thisWindow.ZoomReset();
301
- }
302
-
303
- /**
304
- * Gets the zoom level of the window.
305
- */
306
- export function GetZoomLevel() {
307
- return thisWindow.GetZoomLevel();
308
- }
309
-
310
- /**
311
- * Sets the zoom level of the window.
312
- * @param {number} zoomLevel - The zoom level to set.
313
- */
314
- export function SetZoomLevel(zoomLevel) {
315
- thisWindow.SetZoomLevel(zoomLevel);
316
- }
1
+ /*
2
+ _ __ _ __
3
+ | | / /___ _(_) /____
4
+ | | /| / / __ `/ / / ___/
5
+ | |/ |/ / /_/ / / (__ )
6
+ |__/|__/\__,_/_/_/____/
7
+ The electron alternative for Go
8
+ (c) Lea Anthony 2019-present
9
+ */
10
+
11
+ /* jshint esversion: 9 */
12
+
13
+ // Import screen jsdoc definition from ./screens.js
14
+ /**
15
+ * @typedef {import("./screens").Screen} Screen
16
+ */
17
+
18
+
19
+ /**
20
+ * A record describing the position of a window.
21
+ *
22
+ * @typedef {Object} Position
23
+ * @property {number} x - The horizontal position of the window
24
+ * @property {number} y - The vertical position of the window
25
+ */
26
+
27
+
28
+ /**
29
+ * A record describing the size of a window.
30
+ *
31
+ * @typedef {Object} Size
32
+ * @property {number} width - The width of the window
33
+ * @property {number} height - The height of the window
34
+ */
35
+
36
+
37
+ import {newRuntimeCallerWithID, objectNames} from "./runtime";
38
+
39
+ const AbsolutePositionMethod = 0;
40
+ const CenterMethod = 1;
41
+ const CloseMethod = 2;
42
+ const DisableSizeConstraintsMethod = 3;
43
+ const EnableSizeConstraintsMethod = 4;
44
+ const FocusMethod = 5;
45
+ const ForceReloadMethod = 6;
46
+ const FullscreenMethod = 7;
47
+ const GetScreenMethod = 8;
48
+ const GetZoomMethod = 9;
49
+ const HeightMethod = 10;
50
+ const HideMethod = 11;
51
+ const IsFocusedMethod = 12;
52
+ const IsFullscreenMethod = 13;
53
+ const IsMaximisedMethod = 14;
54
+ const IsMinimisedMethod = 15;
55
+ const MaximiseMethod = 16;
56
+ const MinimiseMethod = 17;
57
+ const NameMethod = 18;
58
+ const OpenDevToolsMethod = 19;
59
+ const RelativePositionMethod = 20;
60
+ const ReloadMethod = 21;
61
+ const ResizableMethod = 22;
62
+ const RestoreMethod = 23;
63
+ const SetAbsolutePositionMethod = 24;
64
+ const SetAlwaysOnTopMethod = 25;
65
+ const SetBackgroundColourMethod = 26;
66
+ const SetFramelessMethod = 27;
67
+ const SetFullscreenButtonEnabledMethod = 28;
68
+ const SetMaxSizeMethod = 29;
69
+ const SetMinSizeMethod = 30;
70
+ const SetRelativePositionMethod = 31;
71
+ const SetResizableMethod = 32;
72
+ const SetSizeMethod = 33;
73
+ const SetTitleMethod = 34;
74
+ const SetZoomMethod = 35;
75
+ const ShowMethod = 36;
76
+ const SizeMethod = 37;
77
+ const ToggleFullscreenMethod = 38;
78
+ const ToggleMaximiseMethod = 39;
79
+ const UnFullscreenMethod = 40;
80
+ const UnMaximiseMethod = 41;
81
+ const UnMinimiseMethod = 42;
82
+ const WidthMethod = 43;
83
+ const ZoomMethod = 44;
84
+ const ZoomInMethod = 45;
85
+ const ZoomOutMethod = 46;
86
+ const ZoomResetMethod = 47;
87
+
88
+ /**
89
+ * @type {symbol}
90
+ */
91
+ const caller = Symbol();
92
+
93
+ class Window {
94
+ /**
95
+ * Initialises a window object with the specified name.
96
+ *
97
+ * @private
98
+ * @param {string} name - The name of the target window.
99
+ */
100
+ constructor(name = '') {
101
+ /**
102
+ * @private
103
+ * @name {@link caller}
104
+ * @type {(...args: any[]) => any}
105
+ */
106
+ this[caller] = newRuntimeCallerWithID(objectNames.Window, name)
107
+
108
+ // bind instance method to make them easily usable in event handlers
109
+ for (const method of Object.getOwnPropertyNames(Window.prototype)) {
110
+ if (
111
+ method !== "constructor"
112
+ && typeof this[method] === "function"
113
+ ) {
114
+ this[method] = this[method].bind(this);
115
+ }
116
+ }
117
+ }
118
+
119
+ /**
120
+ * Gets the specified window.
121
+ *
122
+ * @public
123
+ * @param {string} name - The name of the window to get.
124
+ * @return {Window} - The corresponding window object.
125
+ */
126
+ Get(name) {
127
+ return new Window(name);
128
+ }
129
+
130
+ /**
131
+ * Returns the absolute position of the window to the screen.
132
+ *
133
+ * @public
134
+ * @return {Promise<Position>} - The current absolute position of the window.
135
+ */
136
+ AbsolutePosition() {
137
+ return this[caller](AbsolutePositionMethod);
138
+ }
139
+
140
+ /**
141
+ * Centers the window on the screen.
142
+ *
143
+ * @public
144
+ * @return {Promise<void>}
145
+ */
146
+ Center() {
147
+ return this[caller](CenterMethod);
148
+ }
149
+
150
+ /**
151
+ * Closes the window.
152
+ *
153
+ * @public
154
+ * @return {Promise<void>}
155
+ */
156
+ Close() {
157
+ return this[caller](CloseMethod);
158
+ }
159
+
160
+ /**
161
+ * Disables min/max size constraints.
162
+ *
163
+ * @public
164
+ * @return {Promise<void>}
165
+ */
166
+ DisableSizeConstraints() {
167
+ return this[caller](DisableSizeConstraintsMethod);
168
+ }
169
+
170
+ /**
171
+ * Enables min/max size constraints.
172
+ *
173
+ * @public
174
+ * @return {Promise<void>}
175
+ */
176
+ EnableSizeConstraints() {
177
+ return this[caller](EnableSizeConstraintsMethod);
178
+ }
179
+
180
+ /**
181
+ * Focuses the window.
182
+ *
183
+ * @public
184
+ * @return {Promise<void>}
185
+ */
186
+ Focus() {
187
+ return this[caller](FocusMethod);
188
+ }
189
+
190
+ /**
191
+ * Forces the window to reload the page assets.
192
+ *
193
+ * @public
194
+ * @return {Promise<void>}
195
+ */
196
+ ForceReload() {
197
+ return this[caller](ForceReloadMethod);
198
+ }
199
+
200
+ /**
201
+ * Doc.
202
+ *
203
+ * @public
204
+ * @return {Promise<void>}
205
+ */
206
+ Fullscreen() {
207
+ return this[caller](FullscreenMethod);
208
+ }
209
+
210
+ /**
211
+ * Returns the screen that the window is on.
212
+ *
213
+ * @public
214
+ * @return {Promise<Screen>} - The screen the window is currently on
215
+ */
216
+ GetScreen() {
217
+ return this[caller](GetScreenMethod);
218
+ }
219
+
220
+ /**
221
+ * Returns the current zoom level of the window.
222
+ *
223
+ * @public
224
+ * @return {Promise<number>} - The current zoom level
225
+ */
226
+ GetZoom() {
227
+ return this[caller](GetZoomMethod);
228
+ }
229
+
230
+ /**
231
+ * Returns the height of the window.
232
+ *
233
+ * @public
234
+ * @return {Promise<number>} - The current height of the window
235
+ */
236
+ Height() {
237
+ return this[caller](HeightMethod);
238
+ }
239
+
240
+ /**
241
+ * Hides the window.
242
+ *
243
+ * @public
244
+ * @return {Promise<void>}
245
+ */
246
+ Hide() {
247
+ return this[caller](HideMethod);
248
+ }
249
+
250
+ /**
251
+ * Returns true if the window is focused.
252
+ *
253
+ * @public
254
+ * @return {Promise<boolean>} - Whether the window is currently focused
255
+ */
256
+ IsFocused() {
257
+ return this[caller](IsFocusedMethod);
258
+ }
259
+
260
+ /**
261
+ * Returns true if the window is fullscreen.
262
+ *
263
+ * @public
264
+ * @return {Promise<boolean>} - Whether the window is currently fullscreen
265
+ */
266
+ IsFullscreen() {
267
+ return this[caller](IsFullscreenMethod);
268
+ }
269
+
270
+ /**
271
+ * Returns true if the window is maximised.
272
+ *
273
+ * @public
274
+ * @return {Promise<boolean>} - Whether the window is currently maximised
275
+ */
276
+ IsMaximised() {
277
+ return this[caller](IsMaximisedMethod);
278
+ }
279
+
280
+ /**
281
+ * Returns true if the window is minimised.
282
+ *
283
+ * @public
284
+ * @return {Promise<boolean>} - Whether the window is currently minimised
285
+ */
286
+ IsMinimised() {
287
+ return this[caller](IsMinimisedMethod);
288
+ }
289
+
290
+ /**
291
+ * Maximises the window.
292
+ *
293
+ * @public
294
+ * @return {Promise<void>}
295
+ */
296
+ Maximise() {
297
+ return this[caller](MaximiseMethod);
298
+ }
299
+
300
+ /**
301
+ * Minimises the window.
302
+ *
303
+ * @public
304
+ * @return {Promise<void>}
305
+ */
306
+ Minimise() {
307
+ return this[caller](MinimiseMethod);
308
+ }
309
+
310
+ /**
311
+ * Returns the name of the window.
312
+ *
313
+ * @public
314
+ * @return {Promise<string>} - The name of the window
315
+ */
316
+ Name() {
317
+ return this[caller](NameMethod);
318
+ }
319
+
320
+ /**
321
+ * Opens the development tools pane.
322
+ *
323
+ * @public
324
+ * @return {Promise<void>}
325
+ */
326
+ OpenDevTools() {
327
+ return this[caller](OpenDevToolsMethod);
328
+ }
329
+
330
+ /**
331
+ * Returns the relative position of the window to the screen.
332
+ *
333
+ * @public
334
+ * @return {Promise<Position>} - The current relative position of the window
335
+ */
336
+ RelativePosition() {
337
+ return this[caller](RelativePositionMethod);
338
+ }
339
+
340
+ /**
341
+ * Reloads the page assets.
342
+ *
343
+ * @public
344
+ * @return {Promise<void>}
345
+ */
346
+ Reload() {
347
+ return this[caller](ReloadMethod);
348
+ }
349
+
350
+ /**
351
+ * Returns true if the window is resizable.
352
+ *
353
+ * @public
354
+ * @return {Promise<boolean>} - Whether the window is currently resizable
355
+ */
356
+ Resizable() {
357
+ return this[caller](ResizableMethod);
358
+ }
359
+
360
+ /**
361
+ * Restores the window to its previous state if it was previously minimised, maximised or fullscreen.
362
+ *
363
+ * @public
364
+ * @return {Promise<void>}
365
+ */
366
+ Restore() {
367
+ return this[caller](RestoreMethod);
368
+ }
369
+
370
+ /**
371
+ * Sets the absolute position of the window to the screen.
372
+ *
373
+ * @public
374
+ * @param {number} x - The desired horizontal absolute position of the window
375
+ * @param {number} y - The desired vertical absolute position of the window
376
+ * @return {Promise<void>}
377
+ */
378
+ SetAbsolutePosition(x, y) {
379
+ return this[caller](SetAbsolutePositionMethod, { x, y });
380
+ }
381
+
382
+ /**
383
+ * Sets the window to be always on top.
384
+ *
385
+ * @public
386
+ * @param {boolean} alwaysOnTop - Whether the window should stay on top
387
+ * @return {Promise<void>}
388
+ */
389
+ SetAlwaysOnTop(alwaysOnTop) {
390
+ return this[caller](SetAlwaysOnTopMethod, { alwaysOnTop });
391
+ }
392
+
393
+ /**
394
+ * Sets the background colour of the window.
395
+ *
396
+ * @public
397
+ * @param {number} r - The desired red component of the window background
398
+ * @param {number} g - The desired green component of the window background
399
+ * @param {number} b - The desired blue component of the window background
400
+ * @param {number} a - The desired alpha component of the window background
401
+ * @return {Promise<void>}
402
+ */
403
+ SetBackgroundColour(r, g, b, a) {
404
+ return this[caller](SetBackgroundColourMethod, { r, g, b, a });
405
+ }
406
+
407
+ /**
408
+ * Removes the window frame and title bar.
409
+ *
410
+ * @public
411
+ * @param {boolean} frameless - Whether the window should be frameless
412
+ * @return {Promise<void>}
413
+ */
414
+ SetFrameless(frameless) {
415
+ return this[caller](SetFramelessMethod, { frameless });
416
+ }
417
+
418
+ /**
419
+ * Disables the system fullscreen button.
420
+ *
421
+ * @public
422
+ * @param {boolean} enabled - Whether the fullscreen button should be enabled
423
+ * @return {Promise<void>}
424
+ */
425
+ SetFullscreenButtonEnabled(enabled) {
426
+ return this[caller](SetFullscreenButtonEnabledMethod, { enabled });
427
+ }
428
+
429
+ /**
430
+ * Sets the maximum size of the window.
431
+ *
432
+ * @public
433
+ * @param {number} width - The desired maximum width of the window
434
+ * @param {number} height - The desired maximum height of the window
435
+ * @return {Promise<void>}
436
+ */
437
+ SetMaxSize(width, height) {
438
+ return this[caller](SetMaxSizeMethod, { width, height });
439
+ }
440
+
441
+ /**
442
+ * Sets the minimum size of the window.
443
+ *
444
+ * @public
445
+ * @param {number} width - The desired minimum width of the window
446
+ * @param {number} height - The desired minimum height of the window
447
+ * @return {Promise<void>}
448
+ */
449
+ SetMinSize(width, height) {
450
+ return this[caller](SetMinSizeMethod, { width, height });
451
+ }
452
+
453
+ /**
454
+ * Sets the relative position of the window to the screen.
455
+ *
456
+ * @public
457
+ * @param {number} x - The desired horizontal relative position of the window
458
+ * @param {number} y - The desired vertical relative position of the window
459
+ * @return {Promise<void>}
460
+ */
461
+ SetRelativePosition(x, y) {
462
+ return this[caller](SetRelativePositionMethod, { x, y });
463
+ }
464
+
465
+ /**
466
+ * Sets whether the window is resizable.
467
+ *
468
+ * @public
469
+ * @param {boolean} resizable - Whether the window should be resizable
470
+ * @return {Promise<void>}
471
+ */
472
+ SetResizable(resizable) {
473
+ return this[caller](SetResizableMethod, { resizable });
474
+ }
475
+
476
+ /**
477
+ * Sets the size of the window.
478
+ *
479
+ * @public
480
+ * @param {number} width - The desired width of the window
481
+ * @param {number} height - The desired height of the window
482
+ * @return {Promise<void>}
483
+ */
484
+ SetSize(width, height) {
485
+ return this[caller](SetSizeMethod, { width, height });
486
+ }
487
+
488
+ /**
489
+ * Sets the title of the window.
490
+ *
491
+ * @public
492
+ * @param {string} title - The desired title of the window
493
+ * @return {Promise<void>}
494
+ */
495
+ SetTitle(title) {
496
+ return this[caller](SetTitleMethod, { title });
497
+ }
498
+
499
+ /**
500
+ * Sets the zoom level of the window.
501
+ *
502
+ * @public
503
+ * @param {number} zoom - The desired zoom level
504
+ * @return {Promise<void>}
505
+ */
506
+ SetZoom(zoom) {
507
+ return this[caller](SetZoomMethod, { zoom });
508
+ }
509
+
510
+ /**
511
+ * Shows the window.
512
+ *
513
+ * @public
514
+ * @return {Promise<void>}
515
+ */
516
+ Show() {
517
+ return this[caller](ShowMethod);
518
+ }
519
+
520
+ /**
521
+ * Returns the size of the window.
522
+ *
523
+ * @public
524
+ * @return {Promise<Size>} - The current size of the window
525
+ */
526
+ Size() {
527
+ return this[caller](SizeMethod);
528
+ }
529
+
530
+ /**
531
+ * Toggles the window between fullscreen and normal.
532
+ *
533
+ * @public
534
+ * @return {Promise<void>}
535
+ */
536
+ ToggleFullscreen() {
537
+ return this[caller](ToggleFullscreenMethod);
538
+ }
539
+
540
+ /**
541
+ * Toggles the window between maximised and normal.
542
+ *
543
+ * @public
544
+ * @return {Promise<void>}
545
+ */
546
+ ToggleMaximise() {
547
+ return this[caller](ToggleMaximiseMethod);
548
+ }
549
+
550
+ /**
551
+ * Un-fullscreens the window.
552
+ *
553
+ * @public
554
+ * @return {Promise<void>}
555
+ */
556
+ UnFullscreen() {
557
+ return this[caller](UnFullscreenMethod);
558
+ }
559
+
560
+ /**
561
+ * Un-maximises the window.
562
+ *
563
+ * @public
564
+ * @return {Promise<void>}
565
+ */
566
+ UnMaximise() {
567
+ return this[caller](UnMaximiseMethod);
568
+ }
569
+
570
+ /**
571
+ * Un-minimises the window.
572
+ *
573
+ * @public
574
+ * @return {Promise<void>}
575
+ */
576
+ UnMinimise() {
577
+ return this[caller](UnMinimiseMethod);
578
+ }
579
+
580
+ /**
581
+ * Returns the width of the window.
582
+ *
583
+ * @public
584
+ * @return {Promise<number>} - The current width of the window
585
+ */
586
+ Width() {
587
+ return this[caller](WidthMethod);
588
+ }
589
+
590
+ /**
591
+ * Zooms the window.
592
+ *
593
+ * @public
594
+ * @return {Promise<void>}
595
+ */
596
+ Zoom() {
597
+ return this[caller](ZoomMethod);
598
+ }
599
+
600
+ /**
601
+ * Increases the zoom level of the webview content.
602
+ *
603
+ * @public
604
+ * @return {Promise<void>}
605
+ */
606
+ ZoomIn() {
607
+ return this[caller](ZoomInMethod);
608
+ }
609
+
610
+ /**
611
+ * Decreases the zoom level of the webview content.
612
+ *
613
+ * @public
614
+ * @return {Promise<void>}
615
+ */
616
+ ZoomOut() {
617
+ return this[caller](ZoomOutMethod);
618
+ }
619
+
620
+ /**
621
+ * Resets the zoom level of the webview content.
622
+ *
623
+ * @public
624
+ * @return {Promise<void>}
625
+ */
626
+ ZoomReset() {
627
+ return this[caller](ZoomResetMethod);
628
+ }
629
+ }
630
+
631
+ /**
632
+ * The window within which the script is running.
633
+ *
634
+ * @type {Window}
635
+ */
636
+ const thisWindow = new Window('');
637
+
638
+ export default thisWindow;