2023-06-27 15:53:29 +08:00
|
|
|
/*
|
|
|
|
_ __ _ __
|
|
|
|
| | / /___ _(_) /____
|
|
|
|
| | /| / / __ `/ / / ___/
|
|
|
|
| |/ |/ / /_/ / / (__ )
|
|
|
|
|__/|__/\__,_/_/_/____/
|
|
|
|
The electron alternative for Go
|
|
|
|
(c) Lea Anthony 2019-present
|
|
|
|
*/
|
|
|
|
|
|
|
|
export interface Position {
|
2023-07-17 10:49:53 +08:00
|
|
|
x: number;
|
|
|
|
y: number;
|
2023-06-27 15:53:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface Size {
|
2023-07-17 10:49:53 +08:00
|
|
|
w: number;
|
|
|
|
h: number;
|
2023-06-27 15:53:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface Screen {
|
2023-07-17 10:49:53 +08:00
|
|
|
isCurrent: boolean;
|
|
|
|
isPrimary: boolean;
|
|
|
|
width : number
|
|
|
|
height : number
|
2023-06-27 15:53:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Environment information such as platform, buildtype, ...
|
|
|
|
export interface EnvironmentInfo {
|
2023-07-17 10:49:53 +08:00
|
|
|
buildType: string;
|
|
|
|
platform: string;
|
|
|
|
arch: string;
|
2023-06-27 15:53:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// [EventsEmit](https://wails.io/docs/reference/runtime/events#eventsemit)
|
|
|
|
// emits the given event. Optional data may be passed with the event.
|
|
|
|
// This will trigger any event listeners.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function EventsEmit(eventName: string, ...data: any): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [EventsOn](https://wails.io/docs/reference/runtime/events#eventson) sets up a listener for the given event name.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function EventsOn(eventName: string, callback: (...data: any) => void): () => void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [EventsOnMultiple](https://wails.io/docs/reference/runtime/events#eventsonmultiple)
|
|
|
|
// sets up a listener for the given event name, but will only trigger a given number times.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function EventsOnMultiple(eventName: string, callback: (...data: any) => void, maxCallbacks: number): () => void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [EventsOnce](https://wails.io/docs/reference/runtime/events#eventsonce)
|
|
|
|
// sets up a listener for the given event name, but will only trigger once.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function EventsOnce(eventName: string, callback: (...data: any) => void): () => void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [EventsOff](https://wails.io/docs/reference/runtime/events#eventsoff)
|
|
|
|
// unregisters the listener for the given event name.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function EventsOff(eventName: string, ...additionalEventNames: string[]): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
|
|
|
|
// unregisters all listeners.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function EventsOffAll(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
|
|
|
|
// logs the given message as a raw message
|
2023-07-17 10:49:53 +08:00
|
|
|
export function LogPrint(message: string): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [LogTrace](https://wails.io/docs/reference/runtime/log#logtrace)
|
|
|
|
// logs the given message at the `trace` log level.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function LogTrace(message: string): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [LogDebug](https://wails.io/docs/reference/runtime/log#logdebug)
|
|
|
|
// logs the given message at the `debug` log level.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function LogDebug(message: string): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [LogError](https://wails.io/docs/reference/runtime/log#logerror)
|
|
|
|
// logs the given message at the `error` log level.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function LogError(message: string): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [LogFatal](https://wails.io/docs/reference/runtime/log#logfatal)
|
|
|
|
// logs the given message at the `fatal` log level.
|
|
|
|
// The application will quit after calling this method.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function LogFatal(message: string): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [LogInfo](https://wails.io/docs/reference/runtime/log#loginfo)
|
|
|
|
// logs the given message at the `info` log level.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function LogInfo(message: string): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [LogWarning](https://wails.io/docs/reference/runtime/log#logwarning)
|
|
|
|
// logs the given message at the `warning` log level.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function LogWarning(message: string): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowReload](https://wails.io/docs/reference/runtime/window#windowreload)
|
|
|
|
// Forces a reload by the main application as well as connected browsers.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowReload(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowReloadApp](https://wails.io/docs/reference/runtime/window#windowreloadapp)
|
|
|
|
// Reloads the application frontend.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowReloadApp(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowSetAlwaysOnTop](https://wails.io/docs/reference/runtime/window#windowsetalwaysontop)
|
|
|
|
// Sets the window AlwaysOnTop or not on top.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowSetAlwaysOnTop(b: boolean): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowSetSystemDefaultTheme](https://wails.io/docs/next/reference/runtime/window#windowsetsystemdefaulttheme)
|
|
|
|
// *Windows only*
|
|
|
|
// Sets window theme to system default (dark/light).
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowSetSystemDefaultTheme(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowSetLightTheme](https://wails.io/docs/next/reference/runtime/window#windowsetlighttheme)
|
|
|
|
// *Windows only*
|
|
|
|
// Sets window to light theme.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowSetLightTheme(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowSetDarkTheme](https://wails.io/docs/next/reference/runtime/window#windowsetdarktheme)
|
|
|
|
// *Windows only*
|
|
|
|
// Sets window to dark theme.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowSetDarkTheme(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowCenter](https://wails.io/docs/reference/runtime/window#windowcenter)
|
|
|
|
// Centers the window on the monitor the window is currently on.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowCenter(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowSetTitle](https://wails.io/docs/reference/runtime/window#windowsettitle)
|
|
|
|
// Sets the text in the window title bar.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowSetTitle(title: string): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowFullscreen](https://wails.io/docs/reference/runtime/window#windowfullscreen)
|
|
|
|
// Makes the window full screen.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowFullscreen(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowUnfullscreen](https://wails.io/docs/reference/runtime/window#windowunfullscreen)
|
|
|
|
// Restores the previous window dimensions and position prior to full screen.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowUnfullscreen(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowIsFullscreen](https://wails.io/docs/reference/runtime/window#windowisfullscreen)
|
|
|
|
// Returns the state of the window, i.e. whether the window is in full screen mode or not.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowIsFullscreen(): Promise<boolean>;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowSetSize](https://wails.io/docs/reference/runtime/window#windowsetsize)
|
|
|
|
// Sets the width and height of the window.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowSetSize(width: number, height: number): Promise<Size>;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowGetSize](https://wails.io/docs/reference/runtime/window#windowgetsize)
|
|
|
|
// Gets the width and height of the window.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowGetSize(): Promise<Size>;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowSetMaxSize](https://wails.io/docs/reference/runtime/window#windowsetmaxsize)
|
|
|
|
// Sets the maximum window size. Will resize the window if the window is currently larger than the given dimensions.
|
|
|
|
// Setting a size of 0,0 will disable this constraint.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowSetMaxSize(width: number, height: number): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowSetMinSize](https://wails.io/docs/reference/runtime/window#windowsetminsize)
|
|
|
|
// Sets the minimum window size. Will resize the window if the window is currently smaller than the given dimensions.
|
|
|
|
// Setting a size of 0,0 will disable this constraint.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowSetMinSize(width: number, height: number): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowSetPosition](https://wails.io/docs/reference/runtime/window#windowsetposition)
|
|
|
|
// Sets the window position relative to the monitor the window is currently on.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowSetPosition(x: number, y: number): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowGetPosition](https://wails.io/docs/reference/runtime/window#windowgetposition)
|
|
|
|
// Gets the window position relative to the monitor the window is currently on.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowGetPosition(): Promise<Position>;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowHide](https://wails.io/docs/reference/runtime/window#windowhide)
|
|
|
|
// Hides the window.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowHide(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowShow](https://wails.io/docs/reference/runtime/window#windowshow)
|
|
|
|
// Shows the window, if it is currently hidden.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowShow(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowMaximise](https://wails.io/docs/reference/runtime/window#windowmaximise)
|
|
|
|
// Maximises the window to fill the screen.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowMaximise(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowToggleMaximise](https://wails.io/docs/reference/runtime/window#windowtogglemaximise)
|
|
|
|
// Toggles between Maximised and UnMaximised.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowToggleMaximise(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowUnmaximise](https://wails.io/docs/reference/runtime/window#windowunmaximise)
|
|
|
|
// Restores the window to the dimensions and position prior to maximising.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowUnmaximise(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowIsMaximised](https://wails.io/docs/reference/runtime/window#windowismaximised)
|
|
|
|
// Returns the state of the window, i.e. whether the window is maximised or not.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowIsMaximised(): Promise<boolean>;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowMinimise](https://wails.io/docs/reference/runtime/window#windowminimise)
|
|
|
|
// Minimises the window.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowMinimise(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowUnminimise](https://wails.io/docs/reference/runtime/window#windowunminimise)
|
|
|
|
// Restores the window to the dimensions and position prior to minimising.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowUnminimise(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowIsMinimised](https://wails.io/docs/reference/runtime/window#windowisminimised)
|
|
|
|
// Returns the state of the window, i.e. whether the window is minimised or not.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowIsMinimised(): Promise<boolean>;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowIsNormal](https://wails.io/docs/reference/runtime/window#windowisnormal)
|
|
|
|
// Returns the state of the window, i.e. whether the window is normal or not.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowIsNormal(): Promise<boolean>;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [WindowSetBackgroundColour](https://wails.io/docs/reference/runtime/window#windowsetbackgroundcolour)
|
|
|
|
// Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function WindowSetBackgroundColour(R: number, G: number, B: number, A: number): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [ScreenGetAll](https://wails.io/docs/reference/runtime/window#screengetall)
|
|
|
|
// Gets the all screens. Call this anew each time you want to refresh data from the underlying windowing system.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function ScreenGetAll(): Promise<Screen[]>;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [BrowserOpenURL](https://wails.io/docs/reference/runtime/browser#browseropenurl)
|
|
|
|
// Opens the given URL in the system browser.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function BrowserOpenURL(url: string): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [Environment](https://wails.io/docs/reference/runtime/intro#environment)
|
|
|
|
// Returns information about the environment
|
2023-07-17 10:49:53 +08:00
|
|
|
export function Environment(): Promise<EnvironmentInfo>;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [Quit](https://wails.io/docs/reference/runtime/intro#quit)
|
|
|
|
// Quits the application.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function Quit(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [Hide](https://wails.io/docs/reference/runtime/intro#hide)
|
|
|
|
// Hides the application.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function Hide(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [Show](https://wails.io/docs/reference/runtime/intro#show)
|
|
|
|
// Shows the application.
|
2023-07-17 10:49:53 +08:00
|
|
|
export function Show(): void;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [ClipboardGetText](https://wails.io/docs/reference/runtime/clipboard#clipboardgettext)
|
|
|
|
// Returns the current text stored on clipboard
|
2023-07-17 10:49:53 +08:00
|
|
|
export function ClipboardGetText(): Promise<string>;
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
// [ClipboardSetText](https://wails.io/docs/reference/runtime/clipboard#clipboardsettext)
|
|
|
|
// Sets a text on the clipboard
|
2023-07-17 10:49:53 +08:00
|
|
|
export function ClipboardSetText(text: string): Promise<boolean>;
|