5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 05:11:29 +08:00
wails/v3/internal/runtime/desktop/window.js
Lea Anthony 5dbda4aead
Feature: AssetServer Runtime (#2335)
* Tidy up runtime JS

* Initial implementation of runtime over http

* Update runtime deps. Fix test task.

* Support Clipboard.
Message Processor refactor.

* Add `Window.Screen()`
Clipboard `GetText` -> `Text`

* Support most dialogs
Better JS->Go object mapping
Implement Go->JS callback mechanism
Rename `window.runtime` -> `window.wails` to better reflect the Go API

* Support SaveFile dialog

* Remove go.work

* Tidy up

* Event->CustomEvent to prevent potential clash with native JS Event object
Support Eventing

* Support application calls

* Support logging

* Support named windows
Remove debug info

* Update v3 changes
2023-02-06 20:50:11 +11:00

49 lines
1.8 KiB
JavaScript

/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
/* jshint esversion: 9 */
import {newRuntimeCaller} from "./runtime";
export function newWindow(id) {
let call = newRuntimeCaller("window", id);
return {
// Reload: () => call('WR'),
// ReloadApp: () => call('WR'),
// SetSystemDefaultTheme: () => call('WASDT'),
// SetLightTheme: () => call('WALT'),
// SetDarkTheme: () => call('WADT'),
// IsFullscreen: () => call('WIF'),
// IsMaximized: () => call('WIM'),
// IsMinimized: () => call('WIMN'),
// IsWindowed: () => call('WIF'),
Center: () => call('Center'),
SetTitle: (title) => call('SetTitle', {title}),
Fullscreen: () => call('Fullscreen'),
UnFullscreen: () => call('UnFullscreen'),
SetSize: (width, height) => call('SetSize', {width,height}),
Size: () => { return call('Size') },
SetMaxSize: (width, height) => call('SetMaxSize', {width,height}),
SetMinSize: (width, height) => call('SetMinSize', {width,height}),
SetAlwaysOnTop: (b) => call('SetAlwaysOnTop', {alwaysOnTop:b}),
SetPosition: (x, y) => call('SetPosition', {x,y}),
Position: () => { return call('Position') },
Screen: () => { return call('Screen') },
Hide: () => call('Hide'),
Maximise: () => call('Maximise'),
Show: () => call('Show'),
ToggleMaximise: () => call('ToggleMaximise'),
UnMaximise: () => call('UnMaximise'),
Minimise: () => call('Minimise'),
UnMinimise: () => call('UnMinimise'),
SetBackgroundColour: (r, g, b, a) => call('SetBackgroundColour', {r, g, b, a}),
}
}