github.com/AlpineAIO/wails/v2@v2.0.0-beta.32.0.20240505041856-1047a8fa5fef/pkg/templates/generate/assets/common/frontend/wailsjs/runtime/runtime.d.ts (about)

     1  /*
     2   _       __      _ __
     3  | |     / /___ _(_) /____
     4  | | /| / / __ `/ / / ___/
     5  | |/ |/ / /_/ / / (__  )
     6  |__/|__/\__,_/_/_/____/
     7  The electron alternative for Go
     8  (c) Lea Anthony 2019-present
     9  */
    10  
    11  export interface Position {
    12      x: number;
    13      y: number;
    14  }
    15  
    16  export interface Size {
    17      w: number;
    18      h: number;
    19  }
    20  
    21  export interface Screen {
    22      isCurrent: boolean;
    23      isPrimary: boolean;
    24      width: number
    25      height: number
    26  }
    27  
    28  // Environment information such as platform, buildtype, ...
    29  export interface EnvironmentInfo {
    30      buildType: string;
    31      platform: string;
    32      arch: string;
    33  }
    34  
    35  // [EventsEmit](https://wails.io/docs/reference/runtime/events#eventsemit)
    36  // emits the given event. Optional data may be passed with the event.
    37  // This will trigger any event listeners.
    38  export function EventsEmit(eventName: string, ...data: any): void;
    39  
    40  // [EventsOn](https://wails.io/docs/reference/runtime/events#eventson) sets up a listener for the given event name.
    41  export function EventsOn(eventName: string, callback: (...data: any) => void): void;
    42  
    43  // [EventsOnMultiple](https://wails.io/docs/reference/runtime/events#eventsonmultiple)
    44  // sets up a listener for the given event name, but will only trigger a given number times.
    45  export function EventsOnMultiple(eventName: string, callback: (...data: any) => void, maxCallbacks: number): void;
    46  
    47  // [EventsOnce](https://wails.io/docs/reference/runtime/events#eventsonce)
    48  // sets up a listener for the given event name, but will only trigger once.
    49  export function EventsOnce(eventName: string, callback: (...data: any) => void): void;
    50  
    51  // [EventsOff](https://wails.io/docs/reference/runtime/events#eventsff)
    52  // unregisters the listener for the given event name.
    53  export function EventsOff(eventName: string): void;
    54  
    55  // [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
    56  // logs the given message as a raw message
    57  export function LogPrint(message: string): void;
    58  
    59  // [LogTrace](https://wails.io/docs/reference/runtime/log#logtrace)
    60  // logs the given message at the `trace` log level.
    61  export function LogTrace(message: string): void;
    62  
    63  // [LogDebug](https://wails.io/docs/reference/runtime/log#logdebug)
    64  // logs the given message at the `debug` log level.
    65  export function LogDebug(message: string): void;
    66  
    67  // [LogError](https://wails.io/docs/reference/runtime/log#logerror)
    68  // logs the given message at the `error` log level.
    69  export function LogError(message: string): void;
    70  
    71  // [LogFatal](https://wails.io/docs/reference/runtime/log#logfatal)
    72  // logs the given message at the `fatal` log level.
    73  // The application will quit after calling this method.
    74  export function LogFatal(message: string): void;
    75  
    76  // [LogInfo](https://wails.io/docs/reference/runtime/log#loginfo)
    77  // logs the given message at the `info` log level.
    78  export function LogInfo(message: string): void;
    79  
    80  // [LogWarning](https://wails.io/docs/reference/runtime/log#logwarning)
    81  // logs the given message at the `warning` log level.
    82  export function LogWarning(message: string): void;
    83  
    84  // [WindowReload](https://wails.io/docs/reference/runtime/window#windowreload)
    85  // Forces a reload by the main application as well as connected browsers.
    86  export function WindowReload(): void;
    87  
    88  // [WindowReloadApp](https://wails.io/docs/reference/runtime/window#windowreloadapp)
    89  // Reloads the application frontend.
    90  export function WindowReloadApp(): void;
    91  
    92  // [WindowSetAlwaysOnTop](https://wails.io/docs/reference/runtime/window#windowsetalwaysontop)
    93  // Sets the window AlwaysOnTop or not on top.
    94  export function WindowSetAlwaysOnTop(b: boolean): void;
    95  
    96  // [WindowSetSystemDefaultTheme](https://wails.io/docs/next/reference/runtime/window#windowsetsystemdefaulttheme)
    97  // *Windows only*
    98  // Sets window theme to system default (dark/light).
    99  export function WindowSetSystemDefaultTheme(): void;
   100  
   101  // [WindowSetLightTheme](https://wails.io/docs/next/reference/runtime/window#windowsetlighttheme)
   102  // *Windows only*
   103  // Sets window to light theme.
   104  export function WindowSetLightTheme(): void;
   105  
   106  // [WindowSetDarkTheme](https://wails.io/docs/next/reference/runtime/window#windowsetdarktheme)
   107  // *Windows only*
   108  // Sets window to dark theme.
   109  export function WindowSetDarkTheme(): void;
   110  
   111  // [WindowCenter](https://wails.io/docs/reference/runtime/window#windowcenter)
   112  // Centers the window on the monitor the window is currently on.
   113  export function WindowCenter(): void;
   114  
   115  // [WindowSetTitle](https://wails.io/docs/reference/runtime/window#windowsettitle)
   116  // Sets the text in the window title bar.
   117  export function WindowSetTitle(title: string): void;
   118  
   119  // [WindowFullscreen](https://wails.io/docs/reference/runtime/window#windowfullscreen)
   120  // Makes the window full screen.
   121  export function WindowFullscreen(): void;
   122  
   123  // [WindowUnfullscreen](https://wails.io/docs/reference/runtime/window#windowunfullscreen)
   124  // Restores the previous window dimensions and position prior to full screen.
   125  export function WindowUnfullscreen(): void;
   126  
   127  // [WindowSetSize](https://wails.io/docs/reference/runtime/window#windowsetsize)
   128  // Sets the width and height of the window.
   129  export function WindowSetSize(width: number, height: number): Promise<Size>;
   130  
   131  // [WindowGetSize](https://wails.io/docs/reference/runtime/window#windowgetsize)
   132  // Gets the width and height of the window.
   133  export function WindowGetSize(): Promise<Size>;
   134  
   135  // [WindowSetMaxSize](https://wails.io/docs/reference/runtime/window#windowsetmaxsize)
   136  // Sets the maximum window size. Will resize the window if the window is currently larger than the given dimensions.
   137  // Setting a size of 0,0 will disable this constraint.
   138  export function WindowSetMaxSize(width: number, height: number): void;
   139  
   140  // [WindowSetMinSize](https://wails.io/docs/reference/runtime/window#windowsetminsize)
   141  // Sets the minimum window size. Will resize the window if the window is currently smaller than the given dimensions.
   142  // Setting a size of 0,0 will disable this constraint.
   143  export function WindowSetMinSize(width: number, height: number): void;
   144  
   145  // [WindowSetPosition](https://wails.io/docs/reference/runtime/window#windowsetposition)
   146  // Sets the window position relative to the monitor the window is currently on.
   147  export function WindowSetPosition(x: number, y: number): void;
   148  
   149  // [WindowGetPosition](https://wails.io/docs/reference/runtime/window#windowgetposition)
   150  // Gets the window position relative to the monitor the window is currently on.
   151  export function WindowGetPosition(): Promise<Position>;
   152  
   153  // [WindowHide](https://wails.io/docs/reference/runtime/window#windowhide)
   154  // Hides the window.
   155  export function WindowHide(): void;
   156  
   157  // [WindowShow](https://wails.io/docs/reference/runtime/window#windowshow)
   158  // Shows the window, if it is currently hidden.
   159  export function WindowShow(): void;
   160  
   161  // [WindowMaximise](https://wails.io/docs/reference/runtime/window#windowmaximise)
   162  // Maximises the window to fill the screen.
   163  export function WindowMaximise(): void;
   164  
   165  // [WindowToggleMaximise](https://wails.io/docs/reference/runtime/window#windowtogglemaximise)
   166  // Toggles between Maximised and UnMaximised.
   167  export function WindowToggleMaximise(): void;
   168  
   169  // [WindowUnmaximise](https://wails.io/docs/reference/runtime/window#windowunmaximise)
   170  // Restores the window to the dimensions and position prior to maximising.
   171  export function WindowUnmaximise(): void;
   172  
   173  // [WindowMinimise](https://wails.io/docs/reference/runtime/window#windowminimise)
   174  // Minimises the window.
   175  export function WindowMinimise(): void;
   176  
   177  // [WindowUnminimise](https://wails.io/docs/reference/runtime/window#windowunminimise)
   178  // Restores the window to the dimensions and position prior to minimising.
   179  export function WindowUnminimise(): void;
   180  
   181  // [WindowSetBackgroundColour](https://wails.io/docs/reference/runtime/window#windowsetbackgroundcolour)
   182  // Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels.
   183  export function WindowSetBackgroundColour(R: number, G: number, B: number, A: number): void;
   184  
   185  // [ScreenGetAll](https://wails.io/docs/reference/runtime/window#screengetall)
   186  // Gets the all screens. Call this anew each time you want to refresh data from the underlying windowing system.
   187  export function ScreenGetAll(): Promise<Screen[]>;
   188  
   189  // [BrowserOpenURL](https://wails.io/docs/reference/runtime/browser#browseropenurl)
   190  // Opens the given URL in the system browser.
   191  export function BrowserOpenURL(url: string): void;
   192  
   193  // [Environment](https://wails.io/docs/reference/runtime/intro#environment)
   194  // Returns information about the environment
   195  export function Environment(): Promise<EnvironmentInfo>;
   196  
   197  // [Quit](https://wails.io/docs/reference/runtime/intro#quit)
   198  // Quits the application.
   199  export function Quit(): void;
   200  
   201  // [Hide](https://wails.io/docs/reference/runtime/intro#hide)
   202  // Hides the application.
   203  export function Hide(): void;
   204  
   205  // [Show](https://wails.io/docs/reference/runtime/intro#show)
   206  // Shows the application.
   207  export function Show(): void;