mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
@wails/runtime@v3.0.0-alpha.14
This commit is contained in:
+116
-397
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@wailsio/runtime",
|
||||
"version": "3.0.0-alpha.13",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Wails Runtime",
|
||||
"main": "src/index.js",
|
||||
"types": "types/index.d.ts",
|
||||
@@ -10,7 +10,10 @@
|
||||
},
|
||||
"scripts": {
|
||||
"prebuild:types": "rimraf ./types",
|
||||
"build:types": "npx -p typescript tsc src/index.js --declaration --allowJs --emitDeclarationOnly --outDir types"
|
||||
"build:types": "npx -p typescript tsc src/index.js --declaration --allowJs --emitDeclarationOnly --outDir types",
|
||||
"postbuild:types": "wails3 task generate:events",
|
||||
"build:docs": "npx typedoc ./src/index.js",
|
||||
"build:docs:md": "npx typedoc --plugin typedoc-plugin-markdown --namedAnchors true --hideBreadcrumbs true --out ../../../../../../mkdocs-website/docs/en/api/js ./src/index.js"
|
||||
},
|
||||
"author": "The Wails Team",
|
||||
"license": "MIT",
|
||||
@@ -21,6 +24,8 @@
|
||||
"private": false,
|
||||
"devDependencies": {
|
||||
"rimraf": "^5.0.5",
|
||||
"typedoc": "^0.25.7",
|
||||
"typedoc-plugin-markdown": "^3.17.1",
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,11 @@ window._wails = window._wails || {};
|
||||
window._wails.callResultHandler = resultHandler;
|
||||
window._wails.callErrorHandler = errorHandler;
|
||||
|
||||
/**
|
||||
* Generates a unique ID using the nanoid library.
|
||||
*
|
||||
* @return {string} - A unique ID that does not exist in the callResponses set.
|
||||
*/
|
||||
function generateID() {
|
||||
let result;
|
||||
do {
|
||||
@@ -28,26 +33,57 @@ function generateID() {
|
||||
return result;
|
||||
}
|
||||
|
||||
export function resultHandler(id, data, isJSON) {
|
||||
/**
|
||||
* Handles the result of a call request.
|
||||
*
|
||||
* @param {string} id - The id of the request to handle the result for.
|
||||
* @param {string} data - The result data of the request.
|
||||
* @param {boolean} isJSON - Indicates whether the data is JSON or not.
|
||||
*
|
||||
* @return {undefined} - This method does not return any value.
|
||||
*/
|
||||
function resultHandler(id, data, isJSON) {
|
||||
const promiseHandler = getAndDeleteResponse(id);
|
||||
if (promiseHandler) {
|
||||
promiseHandler.resolve(isJSON ? JSON.parse(data) : data);
|
||||
}
|
||||
}
|
||||
|
||||
export function errorHandler(id, message) {
|
||||
/**
|
||||
* Handles the error from a call request.
|
||||
*
|
||||
* @param {string} id - The id of the promise handler.
|
||||
* @param {string} message - The error message to reject the promise handler with.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function errorHandler(id, message) {
|
||||
const promiseHandler = getAndDeleteResponse(id);
|
||||
if (promiseHandler) {
|
||||
promiseHandler.reject(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves and removes the response associated with the given ID from the callResponses map.
|
||||
*
|
||||
* @param {any} id - The ID of the response to be retrieved and removed.
|
||||
*
|
||||
* @returns {any} The response object associated with the given ID.
|
||||
*/
|
||||
function getAndDeleteResponse(id) {
|
||||
const response = callResponses.get(id);
|
||||
callResponses.delete(id);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a call using the provided type and options.
|
||||
*
|
||||
* @param {string|number} type - The type of call to execute.
|
||||
* @param {Object} [options={}] - Additional options for the call.
|
||||
* @return {Promise} - A promise that will be resolved or rejected based on the result of the call.
|
||||
*/
|
||||
function callBinding(type, options = {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const id = generateID();
|
||||
|
||||
@@ -11,9 +11,66 @@ The electron alternative for Go
|
||||
/* jshint esversion: 9 */
|
||||
|
||||
/**
|
||||
* @typedef {import("./types").MessageDialogOptions} MessageDialogOptions
|
||||
* @typedef {import("./types").OpenDialogOptions} OpenDialogOptions
|
||||
* @typedef {import("./types").SaveDialogOptions} SaveDialogOptions
|
||||
* @typedef {Object} OpenFileDialogOptions
|
||||
* @property {boolean} [CanChooseDirectories] - Indicates if directories can be chosen.
|
||||
* @property {boolean} [CanChooseFiles] - Indicates if files can be chosen.
|
||||
* @property {boolean} [CanCreateDirectories] - Indicates if directories can be created.
|
||||
* @property {boolean} [ShowHiddenFiles] - Indicates if hidden files should be shown.
|
||||
* @property {boolean} [ResolvesAliases] - Indicates if aliases should be resolved.
|
||||
* @property {boolean} [AllowsMultipleSelection] - Indicates if multiple selection is allowed.
|
||||
* @property {boolean} [HideExtension] - Indicates if the extension should be hidden.
|
||||
* @property {boolean} [CanSelectHiddenExtension] - Indicates if hidden extensions can be selected.
|
||||
* @property {boolean} [TreatsFilePackagesAsDirectories] - Indicates if file packages should be treated as directories.
|
||||
* @property {boolean} [AllowsOtherFiletypes] - Indicates if other file types are allowed.
|
||||
* @property {FileFilter[]} [Filters] - Array of file filters.
|
||||
* @property {string} [Title] - Title of the dialog.
|
||||
* @property {string} [Message] - Message to show in the dialog.
|
||||
* @property {string} [ButtonText] - Text to display on the button.
|
||||
* @property {string} [Directory] - Directory to open in the dialog.
|
||||
* @property {boolean} [Detached] - Indicates if the dialog should appear detached from the main window.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Object} SaveFileDialogOptions
|
||||
* @property {string} [Filename] - Default filename to use in the dialog.
|
||||
* @property {boolean} [CanChooseDirectories] - Indicates if directories can be chosen.
|
||||
* @property {boolean} [CanChooseFiles] - Indicates if files can be chosen.
|
||||
* @property {boolean} [CanCreateDirectories] - Indicates if directories can be created.
|
||||
* @property {boolean} [ShowHiddenFiles] - Indicates if hidden files should be shown.
|
||||
* @property {boolean} [ResolvesAliases] - Indicates if aliases should be resolved.
|
||||
* @property {boolean} [AllowsMultipleSelection] - Indicates if multiple selection is allowed.
|
||||
* @property {boolean} [HideExtension] - Indicates if the extension should be hidden.
|
||||
* @property {boolean} [CanSelectHiddenExtension] - Indicates if hidden extensions can be selected.
|
||||
* @property {boolean} [TreatsFilePackagesAsDirectories] - Indicates if file packages should be treated as directories.
|
||||
* @property {boolean} [AllowsOtherFiletypes] - Indicates if other file types are allowed.
|
||||
* @property {FileFilter[]} [Filters] - Array of file filters.
|
||||
* @property {string} [Title] - Title of the dialog.
|
||||
* @property {string} [Message] - Message to show in the dialog.
|
||||
* @property {string} [ButtonText] - Text to display on the button.
|
||||
* @property {string} [Directory] - Directory to open in the dialog.
|
||||
* @property {boolean} [Detached] - Indicates if the dialog should appear detached from the main window.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MessageDialogOptions
|
||||
* @property {string} [Title] - The title of the dialog window.
|
||||
* @property {string} [Message] - The main message to show in the dialog.
|
||||
* @property {Button[]} [Buttons] - Array of button options to show in the dialog.
|
||||
* @property {boolean} [Detached] - True if the dialog should appear detached from the main window (if applicable).
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} Button
|
||||
* @property {string} [Label] - Text that appears within the button.
|
||||
* @property {boolean} [IsCancel] - True if the button should cancel an operation when clicked.
|
||||
* @property {boolean} [IsDefault] - True if the button should be the default action when the user presses enter.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} FileFilter
|
||||
* @property {string} [DisplayName] - Display name for the filter, it could be "Text Files", "Images" etc.
|
||||
* @property {string} [Pattern] - Pattern to match for the filter, e.g. "*.txt;*.md" for text markdown files.
|
||||
*/
|
||||
|
||||
import {newRuntimeCallerWithID, objectNames} from "./runtime";
|
||||
@@ -46,7 +103,7 @@ function generateID() {
|
||||
/**
|
||||
* Shows a dialog of specified type with the given options.
|
||||
* @param {number} type - type of dialog
|
||||
* @param {object} options - options for the dialog
|
||||
* @param {MessageDialogOptions|OpenFileDialogOptions|SaveFileDialogOptions} options - options for the dialog
|
||||
* @returns {Promise} promise that resolves with result of dialog
|
||||
*/
|
||||
function dialog(type, options = {}) {
|
||||
@@ -61,6 +118,10 @@ function dialog(type, options = {}) {
|
||||
});
|
||||
}
|
||||
|
||||
window._wails = window._wails || {};
|
||||
window._wails.dialogErrorCallback = dialogErrorCallback;
|
||||
window._wails.dialogResultCallback = dialogResultCallback;
|
||||
|
||||
/**
|
||||
* Handles the callback from a dialog.
|
||||
*
|
||||
@@ -70,7 +131,7 @@ function dialog(type, options = {}) {
|
||||
*
|
||||
* @return {undefined}
|
||||
*/
|
||||
export function dialogResultCallback(id, data, isJSON) {
|
||||
function dialogResultCallback(id, data, isJSON) {
|
||||
let p = dialogResponses.get(id);
|
||||
if (p) {
|
||||
if (isJSON) {
|
||||
@@ -90,7 +151,7 @@ export function dialogResultCallback(id, data, isJSON) {
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
export function dialogErrorCallback(id, message) {
|
||||
function dialogErrorCallback(id, message) {
|
||||
let p = dialogResponses.get(id);
|
||||
if (p) {
|
||||
p.reject(message);
|
||||
@@ -126,13 +187,13 @@ export const Error = (options) => dialog(DialogError, options);
|
||||
export const Question = (options) => dialog(DialogQuestion, options);
|
||||
|
||||
/**
|
||||
* @param {OpenDialogOptions} options - Dialog options
|
||||
* @param {OpenFileDialogOptions} options - Dialog options
|
||||
* @returns {Promise<string[]|string>} Returns selected file or list of files. Returns blank string if no file is selected.
|
||||
*/
|
||||
export const OpenFile = (options) => dialog(DialogOpenFile, options);
|
||||
|
||||
/**
|
||||
* @param {SaveDialogOptions} options - Dialog options
|
||||
* @param {SaveFileDialogOptions} options - Dialog options
|
||||
* @returns {Promise<string>} Returns the selected file. Returns blank string if no file is selected.
|
||||
*/
|
||||
export const SaveFile = (options) => dialog(DialogSaveFile, options);
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
|
||||
export const EventTypes = {
|
||||
Windows: {
|
||||
SystemThemeChanged: "windows:SystemThemeChanged",
|
||||
APMPowerStatusChange: "windows:APMPowerStatusChange",
|
||||
APMSuspend: "windows:APMSuspend",
|
||||
APMResumeAutomatic: "windows:APMResumeAutomatic",
|
||||
APMResumeSuspend: "windows:APMResumeSuspend",
|
||||
APMPowerSettingChange: "windows:APMPowerSettingChange",
|
||||
ApplicationStarted: "windows:ApplicationStarted",
|
||||
WebViewNavigationCompleted: "windows:WebViewNavigationCompleted",
|
||||
WindowInactive: "windows:WindowInactive",
|
||||
WindowActive: "windows:WindowActive",
|
||||
WindowClickActive: "windows:WindowClickActive",
|
||||
WindowMaximise: "windows:WindowMaximise",
|
||||
WindowUnMaximise: "windows:WindowUnMaximise",
|
||||
WindowFullscreen: "windows:WindowFullscreen",
|
||||
WindowUnFullscreen: "windows:WindowUnFullscreen",
|
||||
WindowRestore: "windows:WindowRestore",
|
||||
WindowMinimise: "windows:WindowMinimise",
|
||||
WindowUnMinimise: "windows:WindowUnMinimise",
|
||||
WindowClose: "windows:WindowClose",
|
||||
WindowSetFocus: "windows:WindowSetFocus",
|
||||
WindowKillFocus: "windows:WindowKillFocus",
|
||||
WindowDragDrop: "windows:WindowDragDrop",
|
||||
WindowDragEnter: "windows:WindowDragEnter",
|
||||
WindowDragLeave: "windows:WindowDragLeave",
|
||||
WindowDragOver: "windows:WindowDragOver",
|
||||
},
|
||||
Mac: {
|
||||
ApplicationDidBecomeActive: "mac:ApplicationDidBecomeActive",
|
||||
ApplicationDidChangeBackingProperties: "mac:ApplicationDidChangeBackingProperties",
|
||||
ApplicationDidChangeEffectiveAppearance: "mac:ApplicationDidChangeEffectiveAppearance",
|
||||
ApplicationDidChangeIcon: "mac:ApplicationDidChangeIcon",
|
||||
ApplicationDidChangeOcclusionState: "mac:ApplicationDidChangeOcclusionState",
|
||||
ApplicationDidChangeScreenParameters: "mac:ApplicationDidChangeScreenParameters",
|
||||
ApplicationDidChangeStatusBarFrame: "mac:ApplicationDidChangeStatusBarFrame",
|
||||
ApplicationDidChangeStatusBarOrientation: "mac:ApplicationDidChangeStatusBarOrientation",
|
||||
ApplicationDidFinishLaunching: "mac:ApplicationDidFinishLaunching",
|
||||
ApplicationDidHide: "mac:ApplicationDidHide",
|
||||
ApplicationDidResignActiveNotification: "mac:ApplicationDidResignActiveNotification",
|
||||
ApplicationDidUnhide: "mac:ApplicationDidUnhide",
|
||||
ApplicationDidUpdate: "mac:ApplicationDidUpdate",
|
||||
ApplicationWillBecomeActive: "mac:ApplicationWillBecomeActive",
|
||||
ApplicationWillFinishLaunching: "mac:ApplicationWillFinishLaunching",
|
||||
ApplicationWillHide: "mac:ApplicationWillHide",
|
||||
ApplicationWillResignActive: "mac:ApplicationWillResignActive",
|
||||
ApplicationWillTerminate: "mac:ApplicationWillTerminate",
|
||||
ApplicationWillUnhide: "mac:ApplicationWillUnhide",
|
||||
ApplicationWillUpdate: "mac:ApplicationWillUpdate",
|
||||
ApplicationTerminate: "mac:ApplicationTerminate",
|
||||
ApplicationDidChangeTheme: "mac:ApplicationDidChangeTheme!",
|
||||
ApplicationShouldHandleReopen: "mac:ApplicationShouldHandleReopen!",
|
||||
WindowDidBecomeKey: "mac:WindowDidBecomeKey",
|
||||
WindowDidBecomeMain: "mac:WindowDidBecomeMain",
|
||||
WindowDidBeginSheet: "mac:WindowDidBeginSheet",
|
||||
WindowDidChangeAlpha: "mac:WindowDidChangeAlpha",
|
||||
WindowDidChangeBackingLocation: "mac:WindowDidChangeBackingLocation",
|
||||
WindowDidChangeBackingProperties: "mac:WindowDidChangeBackingProperties",
|
||||
WindowDidChangeCollectionBehavior: "mac:WindowDidChangeCollectionBehavior",
|
||||
WindowDidChangeEffectiveAppearance: "mac:WindowDidChangeEffectiveAppearance",
|
||||
WindowDidChangeOcclusionState: "mac:WindowDidChangeOcclusionState",
|
||||
WindowDidChangeOrderingMode: "mac:WindowDidChangeOrderingMode",
|
||||
WindowDidChangeScreen: "mac:WindowDidChangeScreen",
|
||||
WindowDidChangeScreenParameters: "mac:WindowDidChangeScreenParameters",
|
||||
WindowDidChangeScreenProfile: "mac:WindowDidChangeScreenProfile",
|
||||
WindowDidChangeScreenSpace: "mac:WindowDidChangeScreenSpace",
|
||||
WindowDidChangeScreenSpaceProperties: "mac:WindowDidChangeScreenSpaceProperties",
|
||||
WindowDidChangeSharingType: "mac:WindowDidChangeSharingType",
|
||||
WindowDidChangeSpace: "mac:WindowDidChangeSpace",
|
||||
WindowDidChangeSpaceOrderingMode: "mac:WindowDidChangeSpaceOrderingMode",
|
||||
WindowDidChangeTitle: "mac:WindowDidChangeTitle",
|
||||
WindowDidChangeToolbar: "mac:WindowDidChangeToolbar",
|
||||
WindowDidChangeVisibility: "mac:WindowDidChangeVisibility",
|
||||
WindowDidDeminiaturize: "mac:WindowDidDeminiaturize",
|
||||
WindowDidEndSheet: "mac:WindowDidEndSheet",
|
||||
WindowDidEnterFullScreen: "mac:WindowDidEnterFullScreen",
|
||||
WindowDidEnterVersionBrowser: "mac:WindowDidEnterVersionBrowser",
|
||||
WindowDidExitFullScreen: "mac:WindowDidExitFullScreen",
|
||||
WindowDidExitVersionBrowser: "mac:WindowDidExitVersionBrowser",
|
||||
WindowDidExpose: "mac:WindowDidExpose",
|
||||
WindowDidFocus: "mac:WindowDidFocus",
|
||||
WindowDidMiniaturize: "mac:WindowDidMiniaturize",
|
||||
WindowDidMove: "mac:WindowDidMove",
|
||||
WindowDidOrderOffScreen: "mac:WindowDidOrderOffScreen",
|
||||
WindowDidOrderOnScreen: "mac:WindowDidOrderOnScreen",
|
||||
WindowDidResignKey: "mac:WindowDidResignKey",
|
||||
WindowDidResignMain: "mac:WindowDidResignMain",
|
||||
WindowDidResize: "mac:WindowDidResize",
|
||||
WindowDidUpdate: "mac:WindowDidUpdate",
|
||||
WindowDidUpdateAlpha: "mac:WindowDidUpdateAlpha",
|
||||
WindowDidUpdateCollectionBehavior: "mac:WindowDidUpdateCollectionBehavior",
|
||||
WindowDidUpdateCollectionProperties: "mac:WindowDidUpdateCollectionProperties",
|
||||
WindowDidUpdateShadow: "mac:WindowDidUpdateShadow",
|
||||
WindowDidUpdateTitle: "mac:WindowDidUpdateTitle",
|
||||
WindowDidUpdateToolbar: "mac:WindowDidUpdateToolbar",
|
||||
WindowDidUpdateVisibility: "mac:WindowDidUpdateVisibility",
|
||||
WindowShouldClose: "mac:WindowShouldClose!",
|
||||
WindowWillBecomeKey: "mac:WindowWillBecomeKey",
|
||||
WindowWillBecomeMain: "mac:WindowWillBecomeMain",
|
||||
WindowWillBeginSheet: "mac:WindowWillBeginSheet",
|
||||
WindowWillChangeOrderingMode: "mac:WindowWillChangeOrderingMode",
|
||||
WindowWillClose: "mac:WindowWillClose",
|
||||
WindowWillDeminiaturize: "mac:WindowWillDeminiaturize",
|
||||
WindowWillEnterFullScreen: "mac:WindowWillEnterFullScreen",
|
||||
WindowWillEnterVersionBrowser: "mac:WindowWillEnterVersionBrowser",
|
||||
WindowWillExitFullScreen: "mac:WindowWillExitFullScreen",
|
||||
WindowWillExitVersionBrowser: "mac:WindowWillExitVersionBrowser",
|
||||
WindowWillFocus: "mac:WindowWillFocus",
|
||||
WindowWillMiniaturize: "mac:WindowWillMiniaturize",
|
||||
WindowWillMove: "mac:WindowWillMove",
|
||||
WindowWillOrderOffScreen: "mac:WindowWillOrderOffScreen",
|
||||
WindowWillOrderOnScreen: "mac:WindowWillOrderOnScreen",
|
||||
WindowWillResignMain: "mac:WindowWillResignMain",
|
||||
WindowWillResize: "mac:WindowWillResize",
|
||||
WindowWillUnfocus: "mac:WindowWillUnfocus",
|
||||
WindowWillUpdate: "mac:WindowWillUpdate",
|
||||
WindowWillUpdateAlpha: "mac:WindowWillUpdateAlpha",
|
||||
WindowWillUpdateCollectionBehavior: "mac:WindowWillUpdateCollectionBehavior",
|
||||
WindowWillUpdateCollectionProperties: "mac:WindowWillUpdateCollectionProperties",
|
||||
WindowWillUpdateShadow: "mac:WindowWillUpdateShadow",
|
||||
WindowWillUpdateTitle: "mac:WindowWillUpdateTitle",
|
||||
WindowWillUpdateToolbar: "mac:WindowWillUpdateToolbar",
|
||||
WindowWillUpdateVisibility: "mac:WindowWillUpdateVisibility",
|
||||
WindowWillUseStandardFrame: "mac:WindowWillUseStandardFrame",
|
||||
MenuWillOpen: "mac:MenuWillOpen",
|
||||
MenuDidOpen: "mac:MenuDidOpen",
|
||||
MenuDidClose: "mac:MenuDidClose",
|
||||
MenuWillSendAction: "mac:MenuWillSendAction",
|
||||
MenuDidSendAction: "mac:MenuDidSendAction",
|
||||
MenuWillHighlightItem: "mac:MenuWillHighlightItem",
|
||||
MenuDidHighlightItem: "mac:MenuDidHighlightItem",
|
||||
MenuWillDisplayItem: "mac:MenuWillDisplayItem",
|
||||
MenuDidDisplayItem: "mac:MenuDidDisplayItem",
|
||||
MenuWillAddItem: "mac:MenuWillAddItem",
|
||||
MenuDidAddItem: "mac:MenuDidAddItem",
|
||||
MenuWillRemoveItem: "mac:MenuWillRemoveItem",
|
||||
MenuDidRemoveItem: "mac:MenuDidRemoveItem",
|
||||
MenuWillBeginTracking: "mac:MenuWillBeginTracking",
|
||||
MenuDidBeginTracking: "mac:MenuDidBeginTracking",
|
||||
MenuWillEndTracking: "mac:MenuWillEndTracking",
|
||||
MenuDidEndTracking: "mac:MenuDidEndTracking",
|
||||
MenuWillUpdate: "mac:MenuWillUpdate",
|
||||
MenuDidUpdate: "mac:MenuDidUpdate",
|
||||
MenuWillPopUp: "mac:MenuWillPopUp",
|
||||
MenuDidPopUp: "mac:MenuDidPopUp",
|
||||
MenuWillSendActionToItem: "mac:MenuWillSendActionToItem",
|
||||
MenuDidSendActionToItem: "mac:MenuDidSendActionToItem",
|
||||
WebViewDidStartProvisionalNavigation: "mac:WebViewDidStartProvisionalNavigation",
|
||||
WebViewDidReceiveServerRedirectForProvisionalNavigation: "mac:WebViewDidReceiveServerRedirectForProvisionalNavigation",
|
||||
WebViewDidFinishNavigation: "mac:WebViewDidFinishNavigation",
|
||||
WebViewDidCommitNavigation: "mac:WebViewDidCommitNavigation",
|
||||
WindowFileDraggingEntered: "mac:WindowFileDraggingEntered",
|
||||
WindowFileDraggingPerformed: "mac:WindowFileDraggingPerformed",
|
||||
WindowFileDraggingExited: "mac:WindowFileDraggingExited",
|
||||
},
|
||||
Linux: {
|
||||
SystemThemeChanged: "linux:SystemThemeChanged",
|
||||
},
|
||||
Common: {
|
||||
ApplicationStarted: "common:ApplicationStarted",
|
||||
WindowMaximise: "common:WindowMaximise",
|
||||
WindowUnMaximise: "common:WindowUnMaximise",
|
||||
WindowFullscreen: "common:WindowFullscreen",
|
||||
WindowUnFullscreen: "common:WindowUnFullscreen",
|
||||
WindowRestore: "common:WindowRestore",
|
||||
WindowMinimise: "common:WindowMinimise",
|
||||
WindowUnMinimise: "common:WindowUnMinimise",
|
||||
WindowClosing: "common:WindowClosing",
|
||||
WindowZoom: "common:WindowZoom",
|
||||
WindowZoomIn: "common:WindowZoomIn",
|
||||
WindowZoomOut: "common:WindowZoomOut",
|
||||
WindowZoomReset: "common:WindowZoomReset",
|
||||
WindowFocus: "common:WindowFocus",
|
||||
WindowLostFocus: "common:WindowLostFocus",
|
||||
WindowShow: "common:WindowShow",
|
||||
WindowHide: "common:WindowHide",
|
||||
WindowDPIChanged: "common:WindowDPIChanged",
|
||||
WindowFilesDropped: "common:WindowFilesDropped",
|
||||
ThemeChanged: "common:ThemeChanged",
|
||||
ApplicationTerminate: "common:ApplicationTerminate",
|
||||
},
|
||||
};
|
||||
@@ -15,6 +15,9 @@ The electron alternative for Go
|
||||
*/
|
||||
import {newRuntimeCallerWithID, objectNames} from "./runtime";
|
||||
|
||||
import {EventTypes} from "./event_types";
|
||||
export const Types = EventTypes;
|
||||
|
||||
const call = newRuntimeCallerWithID(objectNames.Events, '');
|
||||
const EmitMethod = 0;
|
||||
const eventListeners = new Map();
|
||||
@@ -43,7 +46,7 @@ export class WailsEvent {
|
||||
window._wails = window._wails || {};
|
||||
window._wails.dispatchWailsEvent = dispatchWailsEvent;
|
||||
|
||||
export function dispatchWailsEvent(event) {
|
||||
function dispatchWailsEvent(event) {
|
||||
let listeners = eventListeners.get(event.name);
|
||||
if (listeners) {
|
||||
let toRemove = listeners.filter(listener => {
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
declare module '@wailsio/runtime';
|
||||
|
||||
/**
|
||||
* Describes the properties of a Button object.
|
||||
*/
|
||||
export interface Button {
|
||||
// Text that appears within the button.
|
||||
Label?: string;
|
||||
// True if the button should cancel an operation when clicked.
|
||||
IsCancel?: boolean;
|
||||
// True if the button should be the default action when the user presses enter.
|
||||
IsDefault?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes the properties of a FileFilter object.
|
||||
*/
|
||||
export interface FileFilter {
|
||||
// Display name for the filter, it could be "Text Files", "Images" etc.
|
||||
DisplayName?: string;
|
||||
// Pattern to match for the filter, e.g. "*.txt;*.md" for text markdown files.
|
||||
Pattern?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes the properties of a Position object.
|
||||
*/
|
||||
export interface Position {
|
||||
X: number;
|
||||
Y: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes the properties of a Size object.
|
||||
* Extends the properties of Position.
|
||||
*/
|
||||
export type Size = Position;
|
||||
|
||||
/**
|
||||
* Describes the properties of a Rect object.
|
||||
* Extends the properties of Size.
|
||||
*/
|
||||
export type Rect = Size & Position;
|
||||
|
||||
/**
|
||||
* Describes the possible rotations a Screen can have.
|
||||
*/
|
||||
export enum Rotation {
|
||||
Zero = 0,
|
||||
Ninety = 90,
|
||||
OneEighty = 180,
|
||||
TwoSeventy = 270
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes the properties of a Screen object.
|
||||
*/
|
||||
export interface Screen {
|
||||
// Unique identifier for the screen.
|
||||
Id: string;
|
||||
// Human readable name of the screen.
|
||||
Name: string;
|
||||
// The resolution scale of the screen. 1 = standard resolution, 2 = high (Retina), etc.
|
||||
Scale: number;
|
||||
// Contains the X and Y coordinates of the screen's position.
|
||||
Position: Position;
|
||||
// Contains the width and height of the screen.
|
||||
Size: Size;
|
||||
// Contains the bounds of the screen in terms of X, Y, Width, and Height.
|
||||
Bounds: Rect;
|
||||
// Contains the area of the screen that is actually usable (excluding taskbar and other system UI).
|
||||
WorkArea: Rect;
|
||||
// True if this is the primary monitor selected by the user in the operating system.
|
||||
IsPrimary: boolean;
|
||||
// The rotation of the screen. Can be one of 0, 90, 180, 270 degrees.
|
||||
Rotation: Rotation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes the properties of a MessageDialogOptions object.
|
||||
*/
|
||||
export interface MessageDialogOptions {
|
||||
// The title of the dialog window.
|
||||
Title?: string;
|
||||
// The main message to show in the dialog.
|
||||
Message?: string;
|
||||
// Array of button options to show in the dialog.
|
||||
Buttons?: Button[];
|
||||
// True if the dialog should appear detached from the main window (if applicable).
|
||||
Detached?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes the properties common to OpenFileDialogOptions and SaveFileDialogOptions objects.
|
||||
*/
|
||||
export interface DialogOptions {
|
||||
CanChooseDirectories?: boolean;
|
||||
CanChooseFiles?: boolean;
|
||||
CanCreateDirectories?: boolean;
|
||||
ShowHiddenFiles?: boolean;
|
||||
ResolvesAliases?: boolean;
|
||||
AllowsMultipleSelection?: boolean;
|
||||
HideExtension?: boolean;
|
||||
CanSelectHiddenExtension?: boolean;
|
||||
TreatsFilePackagesAsDirectories?: boolean;
|
||||
AllowsOtherFiletypes?: boolean;
|
||||
Filters?: FileFilter[];
|
||||
Title?: string;
|
||||
Message?: string;
|
||||
ButtonText?: string;
|
||||
Directory?: string;
|
||||
Detached?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes properties unique to OpenFileDialogOptions.
|
||||
*/
|
||||
export type OpenFileDialogOptions = DialogOptions;
|
||||
|
||||
/**
|
||||
* Describes properties unique to SaveFileDialogOptions.
|
||||
*/
|
||||
export type SaveFileDialogOptions = DialogOptions & {
|
||||
// Default filename to use for the save dialog.
|
||||
Filename?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes the properties of a WailsEvent object.
|
||||
*/
|
||||
export interface WailsEvent {
|
||||
// The name of the event.
|
||||
Name: string;
|
||||
// Any data associated with the event.
|
||||
Data?: unknown;
|
||||
}
|
||||
@@ -10,45 +10,22 @@ The electron alternative for Go
|
||||
|
||||
import {setupContextMenus} from "./contextmenu";
|
||||
import {setupDrag} from "./drag";
|
||||
import {Emit, Off, OffAll, On, Once, OnMultiple, WailsEvent} from './events';
|
||||
import {ByID, ByName, Plugin} from "./calls";
|
||||
import {Error, Info, OpenFile, Question, SaveFile, Warning} from "./dialogs";
|
||||
|
||||
import * as Application from "./application";
|
||||
import * as Browser from "./browser";
|
||||
import * as Clipboard from "./clipboard";
|
||||
import * as ContextMenu from "./contextmenu";
|
||||
import * as Flags from "./flags";
|
||||
import * as Runtime from "./runtime";
|
||||
import * as Screens from "./screens";
|
||||
import * as System from "./system";
|
||||
import * as Window from "./window";
|
||||
import * as WML from './wml';
|
||||
import * as Events from "./events";
|
||||
import * as Dialogs from "./dialogs";
|
||||
import * as Call from "./calls";
|
||||
|
||||
export { Application, Browser, Clipboard, ContextMenu, Flags, Runtime, Screens, System, Window, WML };
|
||||
export { Application, Browser, Call, Clipboard, Dialogs, Events, Flags, Screens, System, Window, WML};
|
||||
|
||||
export const Events = {
|
||||
On,
|
||||
Off,
|
||||
OnMultiple,
|
||||
WailsEvent,
|
||||
OffAll,
|
||||
Emit,
|
||||
Once
|
||||
|
||||
}
|
||||
|
||||
export const Call = {
|
||||
Plugin,
|
||||
ByID,
|
||||
ByName
|
||||
}
|
||||
|
||||
export const Dialogs = {
|
||||
Info,
|
||||
Error,
|
||||
OpenFile, Question, Warning, SaveFile
|
||||
}
|
||||
|
||||
/***
|
||||
This technique for proper load detection is taken from HTMX:
|
||||
|
||||
@@ -10,10 +10,21 @@ The electron alternative for Go
|
||||
|
||||
/* jshint esversion: 9 */
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {import("./api/types").Screen} Screen
|
||||
* @typedef {Object} Screen
|
||||
* @property {string} Id - Unique identifier for the screen.
|
||||
* @property {string} Name - Human readable name of the screen.
|
||||
* @property {number} Scale - The resolution scale of the screen. 1 = standard resolution, 2 = high (Retina), etc.
|
||||
* @property {Position} Position - Contains the X and Y coordinates of the screen's position.
|
||||
* @property {Size} Size - Contains the width and height of the screen.
|
||||
* @property {Rect} Bounds - Contains the bounds of the screen in terms of X, Y, Width, and Height.
|
||||
* @property {Rect} WorkArea - Contains the area of the screen that is actually usable (excluding taskbar and other system UI).
|
||||
* @property {boolean} IsPrimary - True if this is the primary monitor selected by the user in the operating system.
|
||||
* @property {Rotation} Rotation - The rotation of the screen.
|
||||
*/
|
||||
|
||||
|
||||
import {newRuntimeCallerWithID, objectNames} from "./runtime";
|
||||
const call = newRuntimeCallerWithID(objectNames.Screens, '');
|
||||
|
||||
|
||||
@@ -10,12 +10,38 @@ The electron alternative for Go
|
||||
|
||||
/* jshint esversion: 9 */
|
||||
|
||||
// Import screen jsdoc definition from ./screens.js
|
||||
/**
|
||||
* @typedef {import("../api/types").Size} Size
|
||||
* @typedef {import("../api/types").Position} Position
|
||||
* @typedef {import("../api/types").Screen} Screen
|
||||
* @typedef {import("./screens").Screen} Screen
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} Position
|
||||
* @property {number} X - The X coordinate.
|
||||
* @property {number} Y - The Y coordinate.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} Size
|
||||
* @property {number} X - The width.
|
||||
* @property {number} Y - The height.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Object} Rect
|
||||
* @property {number} X - The X coordinate of the top-left corner.
|
||||
* @property {number} Y - The Y coordinate of the top-left corner.
|
||||
* @property {number} Width - The width of the rectangle.
|
||||
* @property {number} Height - The height of the rectangle.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {('Zero'|'Ninety'|'OneEighty'|'TwoSeventy')} Rotation
|
||||
* The rotation of the screen. Can be one of 'Zero', 'Ninety', 'OneEighty', 'TwoSeventy'.
|
||||
*/
|
||||
|
||||
|
||||
import {newRuntimeCallerWithID, objectNames} from "./runtime";
|
||||
|
||||
const center = 0;
|
||||
@@ -49,7 +75,7 @@ const zoomReset = 27;
|
||||
const getZoomLevel = 28;
|
||||
const setZoomLevel = 29;
|
||||
|
||||
const thisWindow = newRuntimeCallerWithID(objectNames.Window, '');
|
||||
const thisWindow = Get('');
|
||||
|
||||
function createWindow(call) {
|
||||
return {
|
||||
@@ -98,25 +124,220 @@ export function Get(windowName) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a map of all methods in the current window.
|
||||
* @returns {Map} - A map of window methods.
|
||||
* Centers the window on the screen.
|
||||
*/
|
||||
export function WindowMethods(targetWindow) {
|
||||
// Create a new map to store methods
|
||||
let result = new Map();
|
||||
|
||||
// Iterate over all properties of the window object
|
||||
for (let method in targetWindow) {
|
||||
// Check if the property is indeed a method (function)
|
||||
if(typeof targetWindow[method] === 'function') {
|
||||
// Add the method to the map
|
||||
result.set(method, targetWindow[method]);
|
||||
}
|
||||
|
||||
}
|
||||
// Return the map of window methods
|
||||
return result;
|
||||
export function Center() {
|
||||
thisWindow.Center();
|
||||
}
|
||||
export default {
|
||||
...Get('')
|
||||
|
||||
/**
|
||||
* Sets the title of the window.
|
||||
* @param {string} title - The title to set.
|
||||
*/
|
||||
export function SetTitle(title) {
|
||||
thisWindow.SetTitle(title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the window to fullscreen.
|
||||
*/
|
||||
export function Fullscreen() {
|
||||
thisWindow.Fullscreen();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the size of the window.
|
||||
* @param {number} width - The width of the window.
|
||||
* @param {number} height - The height of the window.
|
||||
*/
|
||||
export function SetSize(width, height) {
|
||||
thisWindow.SetSize(width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the size of the window.
|
||||
*/
|
||||
export function Size() {
|
||||
return thisWindow.Size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum size of the window.
|
||||
* @param {number} width - The maximum width of the window.
|
||||
* @param {number} height - The maximum height of the window.
|
||||
*/
|
||||
export function SetMaxSize(width, height) {
|
||||
thisWindow.SetMaxSize(width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the minimum size of the window.
|
||||
* @param {number} width - The minimum width of the window.
|
||||
* @param {number} height - The minimum height of the window.
|
||||
*/
|
||||
export function SetMinSize(width, height) {
|
||||
thisWindow.SetMinSize(width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the window to always be on top.
|
||||
* @param {boolean} onTop - Whether the window should always be on top.
|
||||
*/
|
||||
export function SetAlwaysOnTop(onTop) {
|
||||
thisWindow.SetAlwaysOnTop(onTop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the relative position of the window.
|
||||
* @param {number} x - The x-coordinate of the window's position.
|
||||
* @param {number} y - The y-coordinate of the window's position.
|
||||
*/
|
||||
export function SetRelativePosition(x, y) {
|
||||
thisWindow.SetRelativePosition(x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the relative position of the window.
|
||||
*/
|
||||
export function RelativePosition() {
|
||||
return thisWindow.RelativePosition();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the screen that the window is on.
|
||||
*/
|
||||
export function Screen() {
|
||||
return thisWindow.Screen();
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the window.
|
||||
*/
|
||||
export function Hide() {
|
||||
thisWindow.Hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* Maximises the window.
|
||||
*/
|
||||
export function Maximise() {
|
||||
thisWindow.Maximise();
|
||||
}
|
||||
|
||||
/**
|
||||
* Un-maximises the window.
|
||||
*/
|
||||
export function UnMaximise() {
|
||||
thisWindow.UnMaximise();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the maximisation of the window.
|
||||
*/
|
||||
export function ToggleMaximise() {
|
||||
thisWindow.ToggleMaximise();
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimises the window.
|
||||
*/
|
||||
export function Minimise() {
|
||||
thisWindow.Minimise();
|
||||
}
|
||||
|
||||
/**
|
||||
* Un-minimises the window.
|
||||
*/
|
||||
export function UnMinimise() {
|
||||
thisWindow.UnMinimise();
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the window.
|
||||
*/
|
||||
export function Restore() {
|
||||
thisWindow.Restore();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the window.
|
||||
*/
|
||||
export function Show() {
|
||||
thisWindow.Show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the window.
|
||||
*/
|
||||
export function Close() {
|
||||
thisWindow.Close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the background colour of the window.
|
||||
* @param {number} r - The red component of the colour.
|
||||
* @param {number} g - The green component of the colour.
|
||||
* @param {number} b - The blue component of the colour.
|
||||
* @param {number} a - The alpha component of the colour.
|
||||
*/
|
||||
export function SetBackgroundColour(r, g, b, a) {
|
||||
thisWindow.SetBackgroundColour(r, g, b, a);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the window is resizable.
|
||||
* @param {boolean} resizable - Whether the window should be resizable.
|
||||
*/
|
||||
export function SetResizable(resizable) {
|
||||
thisWindow.SetResizable(resizable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the width of the window.
|
||||
*/
|
||||
export function Width() {
|
||||
return thisWindow.Width();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the height of the window.
|
||||
*/
|
||||
export function Height() {
|
||||
return thisWindow.Height();
|
||||
}
|
||||
|
||||
/**
|
||||
* Zooms in the window.
|
||||
*/
|
||||
export function ZoomIn() {
|
||||
thisWindow.ZoomIn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Zooms out the window.
|
||||
*/
|
||||
export function ZoomOut() {
|
||||
thisWindow.ZoomOut();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the zoom of the window.
|
||||
*/
|
||||
export function ZoomReset() {
|
||||
thisWindow.ZoomReset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the zoom level of the window.
|
||||
*/
|
||||
export function GetZoomLevel() {
|
||||
return thisWindow.GetZoomLevel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the zoom level of the window.
|
||||
* @param {number} zoomLevel - The zoom level to set.
|
||||
*/
|
||||
export function SetZoomLevel(zoomLevel) {
|
||||
thisWindow.SetZoomLevel(zoomLevel);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
import {Emit, WailsEvent} from "./events";
|
||||
import {Question} from "./dialogs";
|
||||
import {WindowMethods, Get} from "./window";
|
||||
import {Get} from "./window";
|
||||
import {OpenURL} from "./browser";
|
||||
|
||||
/**
|
||||
@@ -149,3 +149,24 @@ export function Reload() {
|
||||
addWMLWindowListeners();
|
||||
addWMLOpenBrowserListener();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a map of all methods in the current window.
|
||||
* @returns {Map} - A map of window methods.
|
||||
*/
|
||||
function WindowMethods(targetWindow) {
|
||||
// Create a new map to store methods
|
||||
let result = new Map();
|
||||
|
||||
// Iterate over all properties of the window object
|
||||
for (let method in targetWindow) {
|
||||
// Check if the property is indeed a method (function)
|
||||
if(typeof targetWindow[method] === 'function') {
|
||||
// Add the method to the map
|
||||
result.set(method, targetWindow[method]);
|
||||
}
|
||||
|
||||
}
|
||||
// Return the map of window methods
|
||||
return result;
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
export function resultHandler(id: any, data: any, isJSON: any): void;
|
||||
export function errorHandler(id: any, message: any): void;
|
||||
/**
|
||||
* Call method.
|
||||
*
|
||||
|
||||
+184
-28
@@ -1,28 +1,184 @@
|
||||
/**
|
||||
* Handles the callback from a dialog.
|
||||
*
|
||||
* @param {string} id - The ID of the dialog response.
|
||||
* @param {string} data - The data received from the dialog.
|
||||
* @param {boolean} isJSON - Flag indicating whether the data is in JSON format.
|
||||
*
|
||||
* @return {undefined}
|
||||
*/
|
||||
export function dialogResultCallback(id: string, data: string, isJSON: boolean): undefined;
|
||||
/**
|
||||
* Callback function for handling errors in dialog.
|
||||
*
|
||||
* @param {string} id - The id of the dialog response.
|
||||
* @param {string} message - The error message.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
export function dialogErrorCallback(id: string, message: string): void;
|
||||
export function Info(options: any): Promise<string>;
|
||||
export function Warning(options: any): Promise<string>;
|
||||
export function Error(options: any): Promise<string>;
|
||||
export function Question(options: any): Promise<string>;
|
||||
export function OpenFile(options: any): Promise<string[] | string>;
|
||||
export function SaveFile(options: any): Promise<string>;
|
||||
export type MessageDialogOptions = any;
|
||||
export type OpenDialogOptions = any;
|
||||
export type SaveDialogOptions = any;
|
||||
export function Info(options: MessageDialogOptions): Promise<string>;
|
||||
export function Warning(options: MessageDialogOptions): Promise<string>;
|
||||
export function Error(options: MessageDialogOptions): Promise<string>;
|
||||
export function Question(options: MessageDialogOptions): Promise<string>;
|
||||
export function OpenFile(options: OpenFileDialogOptions): Promise<string[] | string>;
|
||||
export function SaveFile(options: SaveFileDialogOptions): Promise<string>;
|
||||
export type OpenFileDialogOptions = {
|
||||
/**
|
||||
* - Indicates if directories can be chosen.
|
||||
*/
|
||||
CanChooseDirectories?: boolean;
|
||||
/**
|
||||
* - Indicates if files can be chosen.
|
||||
*/
|
||||
CanChooseFiles?: boolean;
|
||||
/**
|
||||
* - Indicates if directories can be created.
|
||||
*/
|
||||
CanCreateDirectories?: boolean;
|
||||
/**
|
||||
* - Indicates if hidden files should be shown.
|
||||
*/
|
||||
ShowHiddenFiles?: boolean;
|
||||
/**
|
||||
* - Indicates if aliases should be resolved.
|
||||
*/
|
||||
ResolvesAliases?: boolean;
|
||||
/**
|
||||
* - Indicates if multiple selection is allowed.
|
||||
*/
|
||||
AllowsMultipleSelection?: boolean;
|
||||
/**
|
||||
* - Indicates if the extension should be hidden.
|
||||
*/
|
||||
HideExtension?: boolean;
|
||||
/**
|
||||
* - Indicates if hidden extensions can be selected.
|
||||
*/
|
||||
CanSelectHiddenExtension?: boolean;
|
||||
/**
|
||||
* - Indicates if file packages should be treated as directories.
|
||||
*/
|
||||
TreatsFilePackagesAsDirectories?: boolean;
|
||||
/**
|
||||
* - Indicates if other file types are allowed.
|
||||
*/
|
||||
AllowsOtherFiletypes?: boolean;
|
||||
/**
|
||||
* - Array of file filters.
|
||||
*/
|
||||
Filters?: FileFilter[];
|
||||
/**
|
||||
* - Title of the dialog.
|
||||
*/
|
||||
Title?: string;
|
||||
/**
|
||||
* - Message to show in the dialog.
|
||||
*/
|
||||
Message?: string;
|
||||
/**
|
||||
* - Text to display on the button.
|
||||
*/
|
||||
ButtonText?: string;
|
||||
/**
|
||||
* - Directory to open in the dialog.
|
||||
*/
|
||||
Directory?: string;
|
||||
/**
|
||||
* - Indicates if the dialog should appear detached from the main window.
|
||||
*/
|
||||
Detached?: boolean;
|
||||
};
|
||||
export type SaveFileDialogOptions = {
|
||||
/**
|
||||
* - Default filename to use in the dialog.
|
||||
*/
|
||||
Filename?: string;
|
||||
/**
|
||||
* - Indicates if directories can be chosen.
|
||||
*/
|
||||
CanChooseDirectories?: boolean;
|
||||
/**
|
||||
* - Indicates if files can be chosen.
|
||||
*/
|
||||
CanChooseFiles?: boolean;
|
||||
/**
|
||||
* - Indicates if directories can be created.
|
||||
*/
|
||||
CanCreateDirectories?: boolean;
|
||||
/**
|
||||
* - Indicates if hidden files should be shown.
|
||||
*/
|
||||
ShowHiddenFiles?: boolean;
|
||||
/**
|
||||
* - Indicates if aliases should be resolved.
|
||||
*/
|
||||
ResolvesAliases?: boolean;
|
||||
/**
|
||||
* - Indicates if multiple selection is allowed.
|
||||
*/
|
||||
AllowsMultipleSelection?: boolean;
|
||||
/**
|
||||
* - Indicates if the extension should be hidden.
|
||||
*/
|
||||
HideExtension?: boolean;
|
||||
/**
|
||||
* - Indicates if hidden extensions can be selected.
|
||||
*/
|
||||
CanSelectHiddenExtension?: boolean;
|
||||
/**
|
||||
* - Indicates if file packages should be treated as directories.
|
||||
*/
|
||||
TreatsFilePackagesAsDirectories?: boolean;
|
||||
/**
|
||||
* - Indicates if other file types are allowed.
|
||||
*/
|
||||
AllowsOtherFiletypes?: boolean;
|
||||
/**
|
||||
* - Array of file filters.
|
||||
*/
|
||||
Filters?: FileFilter[];
|
||||
/**
|
||||
* - Title of the dialog.
|
||||
*/
|
||||
Title?: string;
|
||||
/**
|
||||
* - Message to show in the dialog.
|
||||
*/
|
||||
Message?: string;
|
||||
/**
|
||||
* - Text to display on the button.
|
||||
*/
|
||||
ButtonText?: string;
|
||||
/**
|
||||
* - Directory to open in the dialog.
|
||||
*/
|
||||
Directory?: string;
|
||||
/**
|
||||
* - Indicates if the dialog should appear detached from the main window.
|
||||
*/
|
||||
Detached?: boolean;
|
||||
};
|
||||
export type MessageDialogOptions = {
|
||||
/**
|
||||
* - The title of the dialog window.
|
||||
*/
|
||||
Title?: string;
|
||||
/**
|
||||
* - The main message to show in the dialog.
|
||||
*/
|
||||
Message?: string;
|
||||
/**
|
||||
* - Array of button options to show in the dialog.
|
||||
*/
|
||||
Buttons?: Button[];
|
||||
/**
|
||||
* - True if the dialog should appear detached from the main window (if applicable).
|
||||
*/
|
||||
Detached?: boolean;
|
||||
};
|
||||
export type Button = {
|
||||
/**
|
||||
* - Text that appears within the button.
|
||||
*/
|
||||
Label?: string;
|
||||
/**
|
||||
* - True if the button should cancel an operation when clicked.
|
||||
*/
|
||||
IsCancel?: boolean;
|
||||
/**
|
||||
* - True if the button should be the default action when the user presses enter.
|
||||
*/
|
||||
IsDefault?: boolean;
|
||||
};
|
||||
export type FileFilter = {
|
||||
/**
|
||||
* - Display name for the filter, it could be "Text Files", "Images" etc.
|
||||
*/
|
||||
DisplayName?: string;
|
||||
/**
|
||||
* - Pattern to match for the filter, e.g. "*.txt;*.md" for text markdown files.
|
||||
*/
|
||||
Pattern?: string;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
|
||||
export declare const EventTypes: {
|
||||
Windows: {
|
||||
SystemThemeChanged: string,
|
||||
APMPowerStatusChange: string,
|
||||
APMSuspend: string,
|
||||
APMResumeAutomatic: string,
|
||||
APMResumeSuspend: string,
|
||||
APMPowerSettingChange: string,
|
||||
ApplicationStarted: string,
|
||||
WebViewNavigationCompleted: string,
|
||||
WindowInactive: string,
|
||||
WindowActive: string,
|
||||
WindowClickActive: string,
|
||||
WindowMaximise: string,
|
||||
WindowUnMaximise: string,
|
||||
WindowFullscreen: string,
|
||||
WindowUnFullscreen: string,
|
||||
WindowRestore: string,
|
||||
WindowMinimise: string,
|
||||
WindowUnMinimise: string,
|
||||
WindowClose: string,
|
||||
WindowSetFocus: string,
|
||||
WindowKillFocus: string,
|
||||
WindowDragDrop: string,
|
||||
WindowDragEnter: string,
|
||||
WindowDragLeave: string,
|
||||
WindowDragOver: string,
|
||||
},
|
||||
Mac: {
|
||||
ApplicationDidBecomeActive: string,
|
||||
ApplicationDidChangeBackingProperties: string,
|
||||
ApplicationDidChangeEffectiveAppearance: string,
|
||||
ApplicationDidChangeIcon: string,
|
||||
ApplicationDidChangeOcclusionState: string,
|
||||
ApplicationDidChangeScreenParameters: string,
|
||||
ApplicationDidChangeStatusBarFrame: string,
|
||||
ApplicationDidChangeStatusBarOrientation: string,
|
||||
ApplicationDidFinishLaunching: string,
|
||||
ApplicationDidHide: string,
|
||||
ApplicationDidResignActiveNotification: string,
|
||||
ApplicationDidUnhide: string,
|
||||
ApplicationDidUpdate: string,
|
||||
ApplicationWillBecomeActive: string,
|
||||
ApplicationWillFinishLaunching: string,
|
||||
ApplicationWillHide: string,
|
||||
ApplicationWillResignActive: string,
|
||||
ApplicationWillTerminate: string,
|
||||
ApplicationWillUnhide: string,
|
||||
ApplicationWillUpdate: string,
|
||||
ApplicationTerminate: string,
|
||||
ApplicationDidChangeTheme: string,
|
||||
ApplicationShouldHandleReopen: string,
|
||||
WindowDidBecomeKey: string,
|
||||
WindowDidBecomeMain: string,
|
||||
WindowDidBeginSheet: string,
|
||||
WindowDidChangeAlpha: string,
|
||||
WindowDidChangeBackingLocation: string,
|
||||
WindowDidChangeBackingProperties: string,
|
||||
WindowDidChangeCollectionBehavior: string,
|
||||
WindowDidChangeEffectiveAppearance: string,
|
||||
WindowDidChangeOcclusionState: string,
|
||||
WindowDidChangeOrderingMode: string,
|
||||
WindowDidChangeScreen: string,
|
||||
WindowDidChangeScreenParameters: string,
|
||||
WindowDidChangeScreenProfile: string,
|
||||
WindowDidChangeScreenSpace: string,
|
||||
WindowDidChangeScreenSpaceProperties: string,
|
||||
WindowDidChangeSharingType: string,
|
||||
WindowDidChangeSpace: string,
|
||||
WindowDidChangeSpaceOrderingMode: string,
|
||||
WindowDidChangeTitle: string,
|
||||
WindowDidChangeToolbar: string,
|
||||
WindowDidChangeVisibility: string,
|
||||
WindowDidDeminiaturize: string,
|
||||
WindowDidEndSheet: string,
|
||||
WindowDidEnterFullScreen: string,
|
||||
WindowDidEnterVersionBrowser: string,
|
||||
WindowDidExitFullScreen: string,
|
||||
WindowDidExitVersionBrowser: string,
|
||||
WindowDidExpose: string,
|
||||
WindowDidFocus: string,
|
||||
WindowDidMiniaturize: string,
|
||||
WindowDidMove: string,
|
||||
WindowDidOrderOffScreen: string,
|
||||
WindowDidOrderOnScreen: string,
|
||||
WindowDidResignKey: string,
|
||||
WindowDidResignMain: string,
|
||||
WindowDidResize: string,
|
||||
WindowDidUpdate: string,
|
||||
WindowDidUpdateAlpha: string,
|
||||
WindowDidUpdateCollectionBehavior: string,
|
||||
WindowDidUpdateCollectionProperties: string,
|
||||
WindowDidUpdateShadow: string,
|
||||
WindowDidUpdateTitle: string,
|
||||
WindowDidUpdateToolbar: string,
|
||||
WindowDidUpdateVisibility: string,
|
||||
WindowShouldClose: string,
|
||||
WindowWillBecomeKey: string,
|
||||
WindowWillBecomeMain: string,
|
||||
WindowWillBeginSheet: string,
|
||||
WindowWillChangeOrderingMode: string,
|
||||
WindowWillClose: string,
|
||||
WindowWillDeminiaturize: string,
|
||||
WindowWillEnterFullScreen: string,
|
||||
WindowWillEnterVersionBrowser: string,
|
||||
WindowWillExitFullScreen: string,
|
||||
WindowWillExitVersionBrowser: string,
|
||||
WindowWillFocus: string,
|
||||
WindowWillMiniaturize: string,
|
||||
WindowWillMove: string,
|
||||
WindowWillOrderOffScreen: string,
|
||||
WindowWillOrderOnScreen: string,
|
||||
WindowWillResignMain: string,
|
||||
WindowWillResize: string,
|
||||
WindowWillUnfocus: string,
|
||||
WindowWillUpdate: string,
|
||||
WindowWillUpdateAlpha: string,
|
||||
WindowWillUpdateCollectionBehavior: string,
|
||||
WindowWillUpdateCollectionProperties: string,
|
||||
WindowWillUpdateShadow: string,
|
||||
WindowWillUpdateTitle: string,
|
||||
WindowWillUpdateToolbar: string,
|
||||
WindowWillUpdateVisibility: string,
|
||||
WindowWillUseStandardFrame: string,
|
||||
MenuWillOpen: string,
|
||||
MenuDidOpen: string,
|
||||
MenuDidClose: string,
|
||||
MenuWillSendAction: string,
|
||||
MenuDidSendAction: string,
|
||||
MenuWillHighlightItem: string,
|
||||
MenuDidHighlightItem: string,
|
||||
MenuWillDisplayItem: string,
|
||||
MenuDidDisplayItem: string,
|
||||
MenuWillAddItem: string,
|
||||
MenuDidAddItem: string,
|
||||
MenuWillRemoveItem: string,
|
||||
MenuDidRemoveItem: string,
|
||||
MenuWillBeginTracking: string,
|
||||
MenuDidBeginTracking: string,
|
||||
MenuWillEndTracking: string,
|
||||
MenuDidEndTracking: string,
|
||||
MenuWillUpdate: string,
|
||||
MenuDidUpdate: string,
|
||||
MenuWillPopUp: string,
|
||||
MenuDidPopUp: string,
|
||||
MenuWillSendActionToItem: string,
|
||||
MenuDidSendActionToItem: string,
|
||||
WebViewDidStartProvisionalNavigation: string,
|
||||
WebViewDidReceiveServerRedirectForProvisionalNavigation: string,
|
||||
WebViewDidFinishNavigation: string,
|
||||
WebViewDidCommitNavigation: string,
|
||||
WindowFileDraggingEntered: string,
|
||||
WindowFileDraggingPerformed: string,
|
||||
WindowFileDraggingExited: string,
|
||||
},
|
||||
Linux: {
|
||||
SystemThemeChanged: string,
|
||||
},
|
||||
Common: {
|
||||
ApplicationStarted: string,
|
||||
WindowMaximise: string,
|
||||
WindowUnMaximise: string,
|
||||
WindowFullscreen: string,
|
||||
WindowUnFullscreen: string,
|
||||
WindowRestore: string,
|
||||
WindowMinimise: string,
|
||||
WindowUnMinimise: string,
|
||||
WindowClosing: string,
|
||||
WindowZoom: string,
|
||||
WindowZoomIn: string,
|
||||
WindowZoomOut: string,
|
||||
WindowZoomReset: string,
|
||||
WindowFocus: string,
|
||||
WindowLostFocus: string,
|
||||
WindowShow: string,
|
||||
WindowHide: string,
|
||||
WindowDPIChanged: string,
|
||||
WindowFilesDropped: string,
|
||||
ThemeChanged: string,
|
||||
ApplicationTerminate: string,
|
||||
},
|
||||
};
|
||||
+191
-1
@@ -1,4 +1,3 @@
|
||||
export function dispatchWailsEvent(event: any): void;
|
||||
/**
|
||||
* Register a callback function to be called multiple times for a specific event.
|
||||
*
|
||||
@@ -46,6 +45,197 @@ export function OffAll(): void;
|
||||
* @returns {any} - The result of the emitted event.
|
||||
*/
|
||||
export function Emit(event: WailsEvent): any;
|
||||
export const Types: {
|
||||
Windows: {
|
||||
SystemThemeChanged: string;
|
||||
APMPowerStatusChange: string;
|
||||
APMSuspend: string;
|
||||
APMResumeAutomatic: string;
|
||||
APMResumeSuspend: string;
|
||||
APMPowerSettingChange: string;
|
||||
ApplicationStarted: string;
|
||||
WebViewNavigationCompleted: string;
|
||||
WindowInactive: string;
|
||||
WindowActive: string;
|
||||
WindowClickActive: string;
|
||||
WindowMaximise: string;
|
||||
WindowUnMaximise: string;
|
||||
WindowFullscreen: string;
|
||||
WindowUnFullscreen: string;
|
||||
WindowRestore: string;
|
||||
WindowMinimise: string;
|
||||
WindowUnMinimise: string;
|
||||
WindowClose: string;
|
||||
WindowSetFocus: string;
|
||||
WindowKillFocus: string;
|
||||
WindowDragDrop: string;
|
||||
WindowDragEnter: string;
|
||||
WindowDragLeave: string;
|
||||
WindowDragOver: string;
|
||||
};
|
||||
Mac: {
|
||||
ApplicationDidBecomeActive: string;
|
||||
ApplicationDidChangeBackingProperties: string;
|
||||
ApplicationDidChangeEffectiveAppearance: string;
|
||||
ApplicationDidChangeIcon: string;
|
||||
ApplicationDidChangeOcclusionState: string;
|
||||
ApplicationDidChangeScreenParameters: string;
|
||||
/**
|
||||
* Register a callback function to be called multiple times for a specific event.
|
||||
*
|
||||
* @param {string} eventName - The name of the event to register the callback for.
|
||||
* @param {function} callback - The callback function to be called when the event is triggered.
|
||||
* @param {number} maxCallbacks - The maximum number of times the callback can be called for the event. Once the maximum number is reached, the callback will no longer be called.
|
||||
*
|
||||
@return {function} - A function that, when called, will unregister the callback from the event.
|
||||
*/
|
||||
ApplicationDidChangeStatusBarFrame: string;
|
||||
ApplicationDidChangeStatusBarOrientation: string;
|
||||
ApplicationDidFinishLaunching: string;
|
||||
ApplicationDidHide: string;
|
||||
ApplicationDidResignActiveNotification: string;
|
||||
ApplicationDidUnhide: string;
|
||||
ApplicationDidUpdate: string;
|
||||
ApplicationWillBecomeActive: string;
|
||||
ApplicationWillFinishLaunching: string;
|
||||
ApplicationWillHide: string;
|
||||
ApplicationWillResignActive: string;
|
||||
ApplicationWillTerminate: string;
|
||||
ApplicationWillUnhide: string;
|
||||
ApplicationWillUpdate: string;
|
||||
ApplicationTerminate: string;
|
||||
ApplicationDidChangeTheme: string;
|
||||
ApplicationShouldHandleReopen: string;
|
||||
WindowDidBecomeKey: string;
|
||||
WindowDidBecomeMain: string;
|
||||
WindowDidBeginSheet: string;
|
||||
WindowDidChangeAlpha: string;
|
||||
WindowDidChangeBackingLocation: string;
|
||||
WindowDidChangeBackingProperties: string;
|
||||
WindowDidChangeCollectionBehavior: string;
|
||||
WindowDidChangeEffectiveAppearance: string;
|
||||
WindowDidChangeOcclusionState: string;
|
||||
WindowDidChangeOrderingMode: string;
|
||||
WindowDidChangeScreen: string;
|
||||
WindowDidChangeScreenParameters: string;
|
||||
WindowDidChangeScreenProfile: string;
|
||||
WindowDidChangeScreenSpace: string;
|
||||
WindowDidChangeScreenSpaceProperties: string;
|
||||
WindowDidChangeSharingType: string;
|
||||
WindowDidChangeSpace: string;
|
||||
WindowDidChangeSpaceOrderingMode: string;
|
||||
WindowDidChangeTitle: string;
|
||||
WindowDidChangeToolbar: string;
|
||||
WindowDidChangeVisibility: string;
|
||||
WindowDidDeminiaturize: string;
|
||||
WindowDidEndSheet: string;
|
||||
WindowDidEnterFullScreen: string;
|
||||
WindowDidEnterVersionBrowser: string;
|
||||
WindowDidExitFullScreen: string;
|
||||
WindowDidExitVersionBrowser: string;
|
||||
WindowDidExpose: string;
|
||||
WindowDidFocus: string;
|
||||
WindowDidMiniaturize: string;
|
||||
WindowDidMove: string;
|
||||
WindowDidOrderOffScreen: string;
|
||||
WindowDidOrderOnScreen: string;
|
||||
WindowDidResignKey: string;
|
||||
WindowDidResignMain: string;
|
||||
WindowDidResize: string;
|
||||
WindowDidUpdate: string;
|
||||
WindowDidUpdateAlpha: string;
|
||||
WindowDidUpdateCollectionBehavior: string;
|
||||
WindowDidUpdateCollectionProperties: string;
|
||||
WindowDidUpdateShadow: string;
|
||||
WindowDidUpdateTitle: string;
|
||||
WindowDidUpdateToolbar: string;
|
||||
WindowDidUpdateVisibility: string;
|
||||
WindowShouldClose: string;
|
||||
WindowWillBecomeKey: string;
|
||||
WindowWillBecomeMain: string;
|
||||
WindowWillBeginSheet: string;
|
||||
WindowWillChangeOrderingMode: string;
|
||||
WindowWillClose: string;
|
||||
WindowWillDeminiaturize: string;
|
||||
WindowWillEnterFullScreen: string;
|
||||
WindowWillEnterVersionBrowser: string;
|
||||
WindowWillExitFullScreen: string;
|
||||
WindowWillExitVersionBrowser: string;
|
||||
WindowWillFocus: string;
|
||||
WindowWillMiniaturize: string;
|
||||
WindowWillMove: string;
|
||||
WindowWillOrderOffScreen: string;
|
||||
WindowWillOrderOnScreen: string;
|
||||
WindowWillResignMain: string;
|
||||
WindowWillResize: string;
|
||||
WindowWillUnfocus: string;
|
||||
WindowWillUpdate: string;
|
||||
WindowWillUpdateAlpha: string;
|
||||
WindowWillUpdateCollectionBehavior: string;
|
||||
WindowWillUpdateCollectionProperties: string;
|
||||
WindowWillUpdateShadow: string;
|
||||
WindowWillUpdateTitle: string;
|
||||
WindowWillUpdateToolbar: string;
|
||||
WindowWillUpdateVisibility: string;
|
||||
WindowWillUseStandardFrame: string;
|
||||
MenuWillOpen: string;
|
||||
MenuDidOpen: string;
|
||||
MenuDidClose: string;
|
||||
MenuWillSendAction: string;
|
||||
MenuDidSendAction: string;
|
||||
MenuWillHighlightItem: string;
|
||||
MenuDidHighlightItem: string;
|
||||
MenuWillDisplayItem: string;
|
||||
MenuDidDisplayItem: string;
|
||||
MenuWillAddItem: string;
|
||||
MenuDidAddItem: string;
|
||||
MenuWillRemoveItem: string;
|
||||
MenuDidRemoveItem: string;
|
||||
MenuWillBeginTracking: string;
|
||||
MenuDidBeginTracking: string;
|
||||
MenuWillEndTracking: string;
|
||||
MenuDidEndTracking: string;
|
||||
MenuWillUpdate: string;
|
||||
MenuDidUpdate: string;
|
||||
MenuWillPopUp: string;
|
||||
MenuDidPopUp: string;
|
||||
MenuWillSendActionToItem: string;
|
||||
MenuDidSendActionToItem: string;
|
||||
WebViewDidStartProvisionalNavigation: string;
|
||||
WebViewDidReceiveServerRedirectForProvisionalNavigation: string;
|
||||
WebViewDidFinishNavigation: string;
|
||||
WebViewDidCommitNavigation: string;
|
||||
WindowFileDraggingEntered: string;
|
||||
WindowFileDraggingPerformed: string;
|
||||
WindowFileDraggingExited: string;
|
||||
};
|
||||
Linux: {
|
||||
SystemThemeChanged: string;
|
||||
};
|
||||
Common: {
|
||||
ApplicationStarted: string;
|
||||
WindowMaximise: string;
|
||||
WindowUnMaximise: string;
|
||||
WindowFullscreen: string;
|
||||
WindowUnFullscreen: string;
|
||||
WindowRestore: string;
|
||||
WindowMinimise: string;
|
||||
WindowUnMinimise: string;
|
||||
WindowClosing: string;
|
||||
WindowZoom: string;
|
||||
WindowZoomIn: string;
|
||||
WindowZoomOut: string;
|
||||
WindowZoomReset: string;
|
||||
WindowFocus: string;
|
||||
WindowLostFocus: string;
|
||||
WindowShow: string;
|
||||
WindowHide: string;
|
||||
WindowDPIChanged: string;
|
||||
WindowFilesDropped: string;
|
||||
ThemeChanged: string;
|
||||
ApplicationTerminate: string;
|
||||
};
|
||||
};
|
||||
export class WailsEvent {
|
||||
constructor(name: any, data?: any);
|
||||
name: any;
|
||||
|
||||
@@ -1,49 +1,12 @@
|
||||
export namespace Events {
|
||||
export { On };
|
||||
export { Off };
|
||||
export { OnMultiple };
|
||||
export { WailsEvent };
|
||||
export { OffAll };
|
||||
export { Emit };
|
||||
export { Once };
|
||||
}
|
||||
export namespace Call {
|
||||
export { Plugin };
|
||||
export { ByID };
|
||||
export { ByName };
|
||||
}
|
||||
export namespace Dialogs {
|
||||
export { Info };
|
||||
export { Error };
|
||||
export { OpenFile };
|
||||
export { Question };
|
||||
export { Warning };
|
||||
export { SaveFile };
|
||||
}
|
||||
import * as Application from "./application";
|
||||
import * as Browser from "./browser";
|
||||
import * as Call from "./calls";
|
||||
import * as Clipboard from "./clipboard";
|
||||
import * as ContextMenu from "./contextmenu";
|
||||
import * as Dialogs from "./dialogs";
|
||||
import * as Events from "./events";
|
||||
import * as Flags from "./flags";
|
||||
import * as Runtime from "./runtime";
|
||||
import * as Screens from "./screens";
|
||||
import * as System from "./system";
|
||||
import * as Window from "./window";
|
||||
import * as WML from "./wml";
|
||||
import { On } from './events';
|
||||
import { Off } from './events';
|
||||
import { OnMultiple } from './events';
|
||||
import { WailsEvent } from './events';
|
||||
import { OffAll } from './events';
|
||||
import { Emit } from './events';
|
||||
import { Once } from './events';
|
||||
import { Plugin } from "./calls";
|
||||
import { ByID } from "./calls";
|
||||
import { ByName } from "./calls";
|
||||
import { Info } from "./dialogs";
|
||||
import { Error } from "./dialogs";
|
||||
import { OpenFile } from "./dialogs";
|
||||
import { Question } from "./dialogs";
|
||||
import { Warning } from "./dialogs";
|
||||
import { SaveFile } from "./dialogs";
|
||||
export { Application, Browser, Clipboard, ContextMenu, Flags, Runtime, Screens, System, Window, WML };
|
||||
import * as WML from './wml';
|
||||
export { Application, Browser, Call, Clipboard, Dialogs, Events, Flags, Screens, System, Window, WML };
|
||||
|
||||
@@ -14,4 +14,41 @@ export function GetPrimary(): Promise<Screen>;
|
||||
* @returns {Promise<Screen>} A promise that resolves with the current active screen.
|
||||
*/
|
||||
export function GetCurrent(): Promise<Screen>;
|
||||
export type Screen = any;
|
||||
export type Screen = {
|
||||
/**
|
||||
* - Unique identifier for the screen.
|
||||
*/
|
||||
Id: string;
|
||||
/**
|
||||
* - Human readable name of the screen.
|
||||
*/
|
||||
Name: string;
|
||||
/**
|
||||
* - The resolution scale of the screen. 1 = standard resolution, 2 = high (Retina), etc.
|
||||
*/
|
||||
Scale: number;
|
||||
/**
|
||||
* - Contains the X and Y coordinates of the screen's position.
|
||||
*/
|
||||
Position: Position;
|
||||
/**
|
||||
* - Contains the width and height of the screen.
|
||||
*/
|
||||
Size: Size;
|
||||
/**
|
||||
* - Contains the bounds of the screen in terms of X, Y, Width, and Height.
|
||||
*/
|
||||
Bounds: Rect;
|
||||
/**
|
||||
* - Contains the area of the screen that is actually usable (excluding taskbar and other system UI).
|
||||
*/
|
||||
WorkArea: Rect;
|
||||
/**
|
||||
* - True if this is the primary monitor selected by the user in the operating system.
|
||||
*/
|
||||
IsPrimary: boolean;
|
||||
/**
|
||||
* - The rotation of the screen.
|
||||
*/
|
||||
Rotation: Rotation;
|
||||
};
|
||||
|
||||
@@ -5,13 +5,48 @@
|
||||
* @return {Object} - The specified window object.
|
||||
*/
|
||||
export function Get(windowName: string): any;
|
||||
/**
|
||||
* Returns a map of all methods in the current window.
|
||||
* @returns {Map} - A map of window methods.
|
||||
*/
|
||||
export function WindowMethods(targetWindow: any): Map<any, any>;
|
||||
declare const _default: any;
|
||||
export default _default;
|
||||
export type Size = any;
|
||||
export type Position = any;
|
||||
export type Screen = any;
|
||||
export type Screen = import("./screens").Screen;
|
||||
export type Position = {
|
||||
/**
|
||||
* - The X coordinate.
|
||||
*/
|
||||
X: number;
|
||||
/**
|
||||
* - The Y coordinate.
|
||||
*/
|
||||
Y: number;
|
||||
};
|
||||
export type Size = {
|
||||
/**
|
||||
* - The width.
|
||||
*/
|
||||
X: number;
|
||||
/**
|
||||
* - The height.
|
||||
*/
|
||||
Y: number;
|
||||
};
|
||||
export type Rect = {
|
||||
/**
|
||||
* - The X coordinate of the top-left corner.
|
||||
*/
|
||||
X: number;
|
||||
/**
|
||||
* - The Y coordinate of the top-left corner.
|
||||
*/
|
||||
Y: number;
|
||||
/**
|
||||
* - The width of the rectangle.
|
||||
*/
|
||||
Width: number;
|
||||
/**
|
||||
* - The height of the rectangle.
|
||||
*/
|
||||
Height: number;
|
||||
};
|
||||
/**
|
||||
* The rotation of the screen. Can be one of 'Zero', 'Ninety', 'OneEighty', 'TwoSeventy'.
|
||||
*/
|
||||
export type Rotation = ('Zero' | 'Ninety' | 'OneEighty' | 'TwoSeventy');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Reloads the WML system by adding necessary event listeners and browser listeners.
|
||||
* Reloads the WML page by adding necessary event listeners and browser listeners.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user