github.com/secoba/wails/v2@v2.6.4/internal/frontend/runtime/wrapper/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#eventsoff)
    52  // unregisters the listener for the given event name.
    53  export function EventsOff(eventName: string, ...additionalEventNames: string[]): void;
    54  
    55  // [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
    56  // unregisters all listeners.
    57  export function EventsOffAll(): void;
    58  
    59  // [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
    60  // logs the given message as a raw message
    61  export function LogPrint(message: string): void;
    62  
    63  // [LogTrace](https://wails.io/docs/reference/runtime/log#logtrace)
    64  // logs the given message at the `trace` log level.
    65  export function LogTrace(message: string): void;
    66  
    67  // [LogDebug](https://wails.io/docs/reference/runtime/log#logdebug)
    68  // logs the given message at the `debug` log level.
    69  export function LogDebug(message: string): void;
    70  
    71  // [LogError](https://wails.io/docs/reference/runtime/log#logerror)
    72  // logs the given message at the `error` log level.
    73  export function LogError(message: string): void;
    74  
    75  // [LogFatal](https://wails.io/docs/reference/runtime/log#logfatal)
    76  // logs the given message at the `fatal` log level.
    77  // The application will quit after calling this method.
    78  export function LogFatal(message: string): void;
    79  
    80  // [LogInfo](https://wails.io/docs/reference/runtime/log#loginfo)
    81  // logs the given message at the `info` log level.
    82  export function LogInfo(message: string): void;
    83  
    84  // [LogWarning](https://wails.io/docs/reference/runtime/log#logwarning)
    85  // logs the given message at the `warning` log level.
    86  export function LogWarning(message: string): void;
    87  
    88  // [WindowReload](https://wails.io/docs/reference/runtime/window#windowreload)
    89  // Forces a reload by the main application as well as connected browsers.
    90  export function WindowReload(): void;
    91  
    92  // [WindowReloadApp](https://wails.io/docs/reference/runtime/window#windowreloadapp)
    93  // Reloads the application frontend.
    94  export function WindowReloadApp(): void;
    95  
    96  // [WindowSetAlwaysOnTop](https://wails.io/docs/reference/runtime/window#windowsetalwaysontop)
    97  // Sets the window AlwaysOnTop or not on top.
    98  export function WindowSetAlwaysOnTop(b: boolean): void;
    99  
   100  // [WindowSetSystemDefaultTheme](https://wails.io/docs/next/reference/runtime/window#windowsetsystemdefaulttheme)
   101  // *Windows only*
   102  // Sets window theme to system default (dark/light).
   103  export function WindowSetSystemDefaultTheme(): void;
   104  
   105  // [WindowSetLightTheme](https://wails.io/docs/next/reference/runtime/window#windowsetlighttheme)
   106  // *Windows only*
   107  // Sets window to light theme.
   108  export function WindowSetLightTheme(): void;
   109  
   110  // [WindowSetDarkTheme](https://wails.io/docs/next/reference/runtime/window#windowsetdarktheme)
   111  // *Windows only*
   112  // Sets window to dark theme.
   113  export function WindowSetDarkTheme(): void;
   114  
   115  // [WindowCenter](https://wails.io/docs/reference/runtime/window#windowcenter)
   116  // Centers the window on the monitor the window is currently on.
   117  export function WindowCenter(): void;
   118  
   119  // [WindowSetTitle](https://wails.io/docs/reference/runtime/window#windowsettitle)
   120  // Sets the text in the window title bar.
   121  export function WindowSetTitle(title: string): void;
   122  
   123  // [WindowFullscreen](https://wails.io/docs/reference/runtime/window#windowfullscreen)
   124  // Makes the window full screen.
   125  export function WindowFullscreen(): void;
   126  
   127  // [WindowUnfullscreen](https://wails.io/docs/reference/runtime/window#windowunfullscreen)
   128  // Restores the previous window dimensions and position prior to full screen.
   129  export function WindowUnfullscreen(): void;
   130  
   131  // [WindowIsFullscreen](https://wails.io/docs/reference/runtime/window#windowisfullscreen)
   132  // Returns the state of the window, i.e. whether the window is in full screen mode or not.
   133  export function WindowIsFullscreen(): Promise<boolean>;
   134  
   135  // [WindowSetSize](https://wails.io/docs/reference/runtime/window#windowsetsize)
   136  // Sets the width and height of the window.
   137  export function WindowSetSize(width: number, height: number): Promise<Size>;
   138  
   139  // [WindowGetSize](https://wails.io/docs/reference/runtime/window#windowgetsize)
   140  // Gets the width and height of the window.
   141  export function WindowGetSize(): Promise<Size>;
   142  
   143  // [WindowSetMaxSize](https://wails.io/docs/reference/runtime/window#windowsetmaxsize)
   144  // Sets the maximum window size. Will resize the window if the window is currently larger than the given dimensions.
   145  // Setting a size of 0,0 will disable this constraint.
   146  export function WindowSetMaxSize(width: number, height: number): void;
   147  
   148  // [WindowSetMinSize](https://wails.io/docs/reference/runtime/window#windowsetminsize)
   149  // Sets the minimum window size. Will resize the window if the window is currently smaller than the given dimensions.
   150  // Setting a size of 0,0 will disable this constraint.
   151  export function WindowSetMinSize(width: number, height: number): void;
   152  
   153  // [WindowSetPosition](https://wails.io/docs/reference/runtime/window#windowsetposition)
   154  // Sets the window position relative to the monitor the window is currently on.
   155  export function WindowSetPosition(x: number, y: number): void;
   156  
   157  // [WindowGetPosition](https://wails.io/docs/reference/runtime/window#windowgetposition)
   158  // Gets the window position relative to the monitor the window is currently on.
   159  export function WindowGetPosition(): Promise<Position>;
   160  
   161  // [WindowHide](https://wails.io/docs/reference/runtime/window#windowhide)
   162  // Hides the window.
   163  export function WindowHide(): void;
   164  
   165  // [WindowShow](https://wails.io/docs/reference/runtime/window#windowshow)
   166  // Shows the window, if it is currently hidden.
   167  export function WindowShow(): void;
   168  
   169  // [WindowMaximise](https://wails.io/docs/reference/runtime/window#windowmaximise)
   170  // Maximises the window to fill the screen.
   171  export function WindowMaximise(): void;
   172  
   173  // [WindowToggleMaximise](https://wails.io/docs/reference/runtime/window#windowtogglemaximise)
   174  // Toggles between Maximised and UnMaximised.
   175  export function WindowToggleMaximise(): void;
   176  
   177  // [WindowUnmaximise](https://wails.io/docs/reference/runtime/window#windowunmaximise)
   178  // Restores the window to the dimensions and position prior to maximising.
   179  export function WindowUnmaximise(): void;
   180  
   181  // [WindowIsMaximised](https://wails.io/docs/reference/runtime/window#windowismaximised)
   182  // Returns the state of the window, i.e. whether the window is maximised or not.
   183  export function WindowIsMaximised(): Promise<boolean>;
   184  
   185  // [WindowMinimise](https://wails.io/docs/reference/runtime/window#windowminimise)
   186  // Minimises the window.
   187  export function WindowMinimise(): void;
   188  
   189  // [WindowUnminimise](https://wails.io/docs/reference/runtime/window#windowunminimise)
   190  // Restores the window to the dimensions and position prior to minimising.
   191  export function WindowUnminimise(): void;
   192  
   193  // [WindowIsMinimised](https://wails.io/docs/reference/runtime/window#windowisminimised)
   194  // Returns the state of the window, i.e. whether the window is minimised or not.
   195  export function WindowIsMinimised(): Promise<boolean>;
   196  
   197  // [WindowIsNormal](https://wails.io/docs/reference/runtime/window#windowisnormal)
   198  // Returns the state of the window, i.e. whether the window is normal or not.
   199  export function WindowIsNormal(): Promise<boolean>;
   200  
   201  // [WindowSetBackgroundColour](https://wails.io/docs/reference/runtime/window#windowsetbackgroundcolour)
   202  // Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels.
   203  export function WindowSetBackgroundColour(R: number, G: number, B: number, A: number): void;
   204  
   205  // [ScreenGetAll](https://wails.io/docs/reference/runtime/window#screengetall)
   206  // Gets the all screens. Call this anew each time you want to refresh data from the underlying windowing system.
   207  export function ScreenGetAll(): Promise<Screen[]>;
   208  
   209  // [BrowserOpenURL](https://wails.io/docs/reference/runtime/browser#browseropenurl)
   210  // Opens the given URL in the system browser.
   211  export function BrowserOpenURL(url: string): void;
   212  
   213  // [Environment](https://wails.io/docs/reference/runtime/intro#environment)
   214  // Returns information about the environment
   215  export function Environment(): Promise<EnvironmentInfo>;
   216  
   217  // [Quit](https://wails.io/docs/reference/runtime/intro#quit)
   218  // Quits the application.
   219  export function Quit(): void;
   220  
   221  // [Hide](https://wails.io/docs/reference/runtime/intro#hide)
   222  // Hides the application.
   223  export function Hide(): void;
   224  
   225  // [Show](https://wails.io/docs/reference/runtime/intro#show)
   226  // Shows the application.
   227  export function Show(): void;
   228  
   229  // [ClipboardGetText](https://wails.io/docs/reference/runtime/clipboard#clipboardgettext)
   230  // Returns the current text stored on clipboard
   231  export function ClipboardGetText(): Promise<string>;
   232  
   233  // [ClipboardSetText](https://wails.io/docs/reference/runtime/clipboard#clipboardsettext)
   234  // Sets a text on the clipboard
   235  export function ClipboardSetText(text: string): Promise<boolean>;