mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 06:32:10 +08:00
Provide types to runtime api
This commit is contained in:
parent
0d25edc0c4
commit
e91b7832ee
@ -13,6 +13,10 @@ The electron alternative for Go
|
||||
* @typedef {import("./types").MessageDialogOptions} MessageDialogOptions
|
||||
* @typedef {import("./types").OpenDialogOptions} OpenDialogOptions
|
||||
* @typedef {import("./types").SaveDialogOptions} SaveDialogOptions
|
||||
* @typedef {import("./types").Screen} Screen
|
||||
* @typedef {import("./types").Size} Size
|
||||
* @typedef {import("./types").Position} Position
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -11,9 +11,9 @@ The electron alternative for Go
|
||||
/* jshint esversion: 9 */
|
||||
|
||||
/**
|
||||
* @typedef {import("./oldapi/types").MessageDialogOptions} MessageDialogOptions
|
||||
* @typedef {import("./dialogs").OpenDialogOptions} OpenDialogOptions
|
||||
* @typedef {import("./dialogs").SaveDialogOptions} SaveDialogOptions
|
||||
* @typedef {import("./api/types").MessageDialogOptions} MessageDialogOptions
|
||||
* @typedef {import("./api/types").OpenDialogOptions} OpenDialogOptions
|
||||
* @typedef {import("./api/types").SaveDialogOptions} SaveDialogOptions
|
||||
*/
|
||||
|
||||
import {newRuntimeCaller} from "./runtime";
|
||||
|
@ -11,7 +11,7 @@ The electron alternative for Go
|
||||
/* jshint esversion: 9 */
|
||||
|
||||
/**
|
||||
* @typedef {import("./events").CustomEvent} CustomEvent
|
||||
* @typedef {import("./api/types").CustomEvent} CustomEvent
|
||||
*/
|
||||
|
||||
import {newRuntimeCaller} from "./runtime";
|
||||
|
@ -44,7 +44,7 @@ export function newRuntimeCaller(object, id) {
|
||||
}
|
||||
return function (method, args) {
|
||||
args = args || {};
|
||||
args["windowID"] = id;
|
||||
args.windowID = id;
|
||||
return runtimeCall(object + "." + method, args);
|
||||
};
|
||||
}
|
@ -11,7 +11,7 @@ The electron alternative for Go
|
||||
/* jshint esversion: 9 */
|
||||
|
||||
/**
|
||||
* @typedef {import("./screens") Screen} Screen
|
||||
* @typedef {import("./api/types").Screen} Screen
|
||||
*/
|
||||
|
||||
import {newRuntimeCaller} from "./runtime";
|
||||
|
@ -11,9 +11,9 @@ The electron alternative for Go
|
||||
/* jshint esversion: 9 */
|
||||
|
||||
/**
|
||||
* @typedef {import("../api/types/Window").Size} Size
|
||||
* @typedef {import("../api/types/Window").Position} Position
|
||||
* @typedef {import("../api/types/Screen").Screen} Screen
|
||||
* @typedef {import("../api/types").Size} Size
|
||||
* @typedef {import("../api/types").Position} Position
|
||||
* @typedef {import("../api/types").Screen} Screen
|
||||
*/
|
||||
|
||||
import {newRuntimeCaller} from "./runtime";
|
||||
@ -82,9 +82,9 @@ export function newWindow(id) {
|
||||
|
||||
/**
|
||||
* Set window to be always on top.
|
||||
* @param {boolean} Whether the window should be always on top
|
||||
* @param {boolean} onTop Whether the window should be always on top
|
||||
*/
|
||||
SetAlwaysOnTop: (b) => void call('SetAlwaysOnTop', {alwaysOnTop:b}),
|
||||
SetAlwaysOnTop: (onTop) => void call('SetAlwaysOnTop', {alwaysOnTop:onTop}),
|
||||
|
||||
/**
|
||||
* Set the window position.
|
||||
|
@ -3,7 +3,7 @@ import {Emit} from "./events";
|
||||
import {Question} from "./dialogs";
|
||||
|
||||
function sendEvent(event) {
|
||||
let _ = Emit({name: event} );
|
||||
Emit(event);
|
||||
}
|
||||
|
||||
function addWMLEventListeners() {
|
||||
@ -23,7 +23,7 @@ function addWMLEventListeners() {
|
||||
return;
|
||||
}
|
||||
sendEvent(eventType);
|
||||
}
|
||||
};
|
||||
// Remove existing listeners
|
||||
|
||||
element.removeEventListener(trigger, callback);
|
||||
@ -57,7 +57,7 @@ function addWMLWindowListeners() {
|
||||
return;
|
||||
}
|
||||
callWindowMethod(windowMethod);
|
||||
}
|
||||
};
|
||||
|
||||
// Remove existing listeners
|
||||
element.removeEventListener(trigger, callback);
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,26 +1,26 @@
|
||||
package application
|
||||
|
||||
type Screen struct {
|
||||
ID string `json:"id,omitempty"` // A unique identifier for the display
|
||||
Name string `json:"name,omitempty"` // The name of the display
|
||||
Scale float32 `json:"scale,omitempty"` // The scale factor of the display
|
||||
X int `json:"x,omitempty"` // The x-coordinate of the top-left corner of the rectangle
|
||||
Y int `json:"y,omitempty"` // The y-coordinate of the top-left corner of the rectangle
|
||||
Size Size `json:"size"` // The size of the display
|
||||
Bounds Rect `json:"bounds"` // The bounds of the display
|
||||
WorkArea Rect `json:"work_area"` // The work area of the display
|
||||
IsPrimary bool `json:"is_primary,omitempty"` // Whether this is the primary display
|
||||
Rotation float32 `json:"rotation,omitempty"` // The rotation of the display
|
||||
ID string // A unique identifier for the display
|
||||
Name string // The name of the display
|
||||
Scale float32 // The scale factor of the display
|
||||
X int // The x-coordinate of the top-left corner of the rectangle
|
||||
Y int // The y-coordinate of the top-left corner of the rectangle
|
||||
Size Size // The size of the display
|
||||
Bounds Rect // The bounds of the display
|
||||
WorkArea Rect // The work area of the display
|
||||
IsPrimary bool // Whether this is the primary display
|
||||
Rotation float32 // The rotation of the display
|
||||
}
|
||||
|
||||
type Rect struct {
|
||||
X int `json:"x,omitempty"`
|
||||
Y int `json:"y,omitempty"`
|
||||
Width int `json:"width,omitempty"`
|
||||
Height int `json:"height,omitempty"`
|
||||
X int
|
||||
Y int
|
||||
Width int
|
||||
Height int
|
||||
}
|
||||
|
||||
type Size struct {
|
||||
Width int `json:"width,omitempty"`
|
||||
Height int `json:"height,omitempty"`
|
||||
Width int
|
||||
Height int
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user