diff --git a/v2/internal/runtime/js/runtime/main.js b/v2/internal/runtime/js/runtime/main.js index cf62dffb6..1377f382a 100644 --- a/v2/internal/runtime/js/runtime/main.js +++ b/v2/internal/runtime/js/runtime/main.js @@ -16,6 +16,7 @@ const Events = require('./events'); const Init = require('./init'); const System = require('./system'); const Store = require('./store'); +const Window = require('./window'); module.exports = { Browser: Browser, @@ -25,4 +26,5 @@ module.exports = { Log: Log, System: System, Store: Store, + Window: Window, }; \ No newline at end of file diff --git a/v2/internal/runtime/js/runtime/package.json b/v2/internal/runtime/js/runtime/package.json index 3fb70d5ef..ec87e1db9 100644 --- a/v2/internal/runtime/js/runtime/package.json +++ b/v2/internal/runtime/js/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@wails/runtime", - "version": "1.1.0", + "version": "1.2.0", "description": "Wails V2 Javascript runtime library", "main": "main.js", "types": "runtime.d.ts", diff --git a/v2/internal/runtime/js/runtime/window.js b/v2/internal/runtime/js/runtime/window.js new file mode 100644 index 000000000..60548bf5b --- /dev/null +++ b/v2/internal/runtime/js/runtime/window.js @@ -0,0 +1,104 @@ +/* + _ __ _ __ +| | / /___ _(_) /____ +| | /| / / __ `/ / / ___/ +| |/ |/ / /_/ / / (__ ) +|__/|__/\__,_/_/_/____/ +The lightweight framework for web-like apps +(c) Lea Anthony 2019-present +*/ +/* jshint esversion: 6 */ + +/** + * Place the window in the center of the screen + * + * @export + */ +export function Center() { + window.wails.Window.Center(); +} + +/** + * Set the Size of the window + * + * @export + * @param {number} width + * @param {number} height + */ +export function SetSize(width, height) { + window.wails.Window.SetSize(width, height); +} + +/** + * Set the Position of the window + * + * @export + * @param {number} x + * @param {number} y + */ +export function SetPosition(x, y) { + window.wails.Window.SetPosition(x, y); +} + +/** + * Hide the Window + * + * @export + */ +export function Hide() { + window.wails.Window.Hide(); +} + +/** + * Show the Window + * + * @export + */ +export function Show() { + window.wails.Window.Show(); +} + +/** + * Maximise the Window + * + * @export + */ +export function Maximise() { + window.wails.Window.Maximise() +} + +/** + * Unmaximise the Window + * + * @export + */ +export function Unmaximise() { + window.wails.Window.Unmaximise() +} + +/** + * Minimise the Window + * + * @export + */ +export function Minimise() { + window.wails.Window.Minimise(); +} + +/** + * Unminimise the Window + * + * @export + */ +export function Unminimise() { + window.wails.Window.Unminimise(); +} + +/** + * Close the Window + * + * @export + */ +export function Close() { + window.wails.Window.Close(); +}