Socket
Socket
Sign inDemoInstall

@tauri-apps/api

Package Overview
Dependencies
Maintainers
5
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tauri-apps/api - npm Package Compare versions

Comparing version 2.0.0-beta.14 to 2.0.0-beta.15

8

dpi.d.ts

@@ -26,4 +26,4 @@ /**

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const appWindow = getCurrent();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const appWindow = getCurrentWindow();
* const factor = await appWindow.scaleFactor();

@@ -61,4 +61,4 @@ * const size = await appWindow.innerSize();

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const appWindow = getCurrent();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const appWindow = getCurrentWindow();
* const factor = await appWindow.scaleFactor();

@@ -65,0 +65,0 @@ * const position = await appWindow.innerPosition();

@@ -31,4 +31,4 @@ // Copyright 2019-2024 Tauri Programme within The Commons Conservancy

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const appWindow = getCurrent();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const appWindow = getCurrentWindow();
* const factor = await appWindow.scaleFactor();

@@ -70,4 +70,4 @@ * const size = await appWindow.innerSize();

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const appWindow = getCurrent();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const appWindow = getCurrentWindow();
* const factor = await appWindow.scaleFactor();

@@ -74,0 +74,0 @@ * const position = await appWindow.innerPosition();

@@ -51,6 +51,6 @@ type EventTarget = {

WEBVIEW_CREATED = "tauri://webview-created",
DRAG = "tauri://drag",
DROP = "tauri://drop",
DROP_OVER = "tauri://drop-over",
DROP_CANCELLED = "tauri://drag-cancelled"
DRAG_ENTER = "tauri://drag-enter",
DRAG_OVER = "tauri://drag-over",
DRAG_DROP = "tauri://drag-drop",
DRAG_LEAVE = "tauri://drag-leave"
}

@@ -57,0 +57,0 @@ /**

@@ -27,6 +27,6 @@ import { invoke, transformCallback } from './core.js';

TauriEvent["WEBVIEW_CREATED"] = "tauri://webview-created";
TauriEvent["DRAG"] = "tauri://drag";
TauriEvent["DROP"] = "tauri://drop";
TauriEvent["DROP_OVER"] = "tauri://drop-over";
TauriEvent["DROP_CANCELLED"] = "tauri://drag-cancelled";
TauriEvent["DRAG_ENTER"] = "tauri://drag-enter";
TauriEvent["DRAG_OVER"] = "tauri://drag-over";
TauriEvent["DRAG_DROP"] = "tauri://drag-drop";
TauriEvent["DRAG_LEAVE"] = "tauri://drag-leave";
})(TauriEvent || (TauriEvent = {}));

@@ -110,4 +110,5 @@ /**

return listen(event, (eventData) => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
_unlisten(event, eventData.id);
handler(eventData);
_unlisten(event, eventData.id).catch(() => { });
}, options);

@@ -114,0 +115,0 @@ }

@@ -67,7 +67,7 @@ import { InvokeArgs } from './core';

* import { mockWindows } from "@tauri-apps/api/mocks";
* import { getCurrent } from "@tauri-apps/api/window";
* import { getCurrentWindow } from "@tauri-apps/api/window";
*
* mockWindows("main", "second", "third");
*
* const win = getCurrent();
* const win = getCurrentWindow();
*

@@ -74,0 +74,0 @@ * win.label // "main"

@@ -98,7 +98,7 @@ // Copyright 2019-2024 Tauri Programme within The Commons Conservancy

* import { mockWindows } from "@tauri-apps/api/mocks";
* import { getCurrent } from "@tauri-apps/api/window";
* import { getCurrentWindow } from "@tauri-apps/api/window";
*
* mockWindows("main", "second", "third");
*
* const win = getCurrent();
* const win = getCurrentWindow();
*

@@ -105,0 +105,0 @@ * win.label // "main"

{
"name": "@tauri-apps/api",
"version": "2.0.0-beta.14",
"version": "2.0.0-beta.15",
"description": "Tauri API definitions",

@@ -53,10 +53,10 @@ "funding": {

"@types/eslint": "^8.56.10",
"@types/node": "20.14.2",
"@types/node": "20.14.10",
"eslint": "^9.4.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-security": "3.0.0",
"eslint-plugin-security": "3.0.1",
"fast-glob": "3.3.2",
"globals": "^15.4.0",
"prettier": "3.3.2",
"rollup": "4.18.0",
"rollup": "4.18.1",
"tslib": "^2.6.3",

@@ -63,0 +63,0 @@ "typescript": "^5.4.5",

@@ -8,4 +8,4 @@ /**

* ```typescript
* import { getCurrent } from "@tauri-apps/api/webview";
* getCurrent().listen("my-webview-event", ({ event, payload }) => { });
* import { getCurrentWebview } from "@tauri-apps/api/webview";
* getCurrentWebview().listen("my-webview-event", ({ event, payload }) => { });
* ```

@@ -21,18 +21,16 @@ *

import { WebviewWindow } from './webviewWindow';
interface DragDropPayload {
/** The drag and drop event types. */
type DragDropEvent = {
type: 'enter';
paths: string[];
position: PhysicalPosition;
}
interface DragOverPayload {
} | {
type: 'over';
position: PhysicalPosition;
}
/** The drag and drop event types. */
type DragDropEvent = ({
type: 'dragged';
} & DragDropPayload) | ({
type: 'dragOver';
} & DragOverPayload) | ({
type: 'dropped';
} & DragDropPayload) | {
type: 'cancelled';
} | {
type: 'drop';
paths: string[];
position: PhysicalPosition;
} | {
type: 'leave';
};

@@ -44,3 +42,3 @@ /**

*/
declare function getCurrent(): Webview;
declare function getCurrentWebview(): Webview;
/**

@@ -51,3 +49,3 @@ * Gets a list of instances of `Webview` for all available webviews.

*/
declare function getAll(): Webview[];
declare function getAllWebviews(): Webview[];
/** @ignore */

@@ -148,4 +146,4 @@ export type WebviewLabel = string;

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* const unlisten = await getCurrent().listen<string>('state-changed', (event) => {
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* const unlisten = await getCurrentWebview().listen<string>('state-changed', (event) => {
* console.log(`Got error: ${payload}`);

@@ -169,3 +167,3 @@ * });

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* const unlisten = await getCurrent().once<null>('initialized', (event) => {

@@ -184,3 +182,3 @@ * console.log(`Webview initialized!`);

*/
once<T>(event: string, handler: EventCallback<T>): Promise<UnlistenFn>;
once<T>(event: EventName, handler: EventCallback<T>): Promise<UnlistenFn>;
/**

@@ -191,4 +189,4 @@ * Emits an event to all {@link EventTarget|targets}.

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* await getCurrent().emit('webview-loaded', { loggedIn: true, token: 'authToken' });
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* await getCurrentWebview().emit('webview-loaded', { loggedIn: true, token: 'authToken' });
* ```

@@ -205,4 +203,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* await getCurrent().emitTo('main', 'webview-loaded', { loggedIn: true, token: 'authToken' });
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* await getCurrentWebview().emitTo('main', 'webview-loaded', { loggedIn: true, token: 'authToken' });
* ```

@@ -221,4 +219,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* const position = await getCurrent().position();
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* const position = await getCurrentWebview().position();
* ```

@@ -234,4 +232,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* const size = await getCurrent().size();
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* const size = await getCurrentWebview().size();
* ```

@@ -246,4 +244,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* await getCurrent().close();
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* await getCurrentWebview().close();
* ```

@@ -259,3 +257,3 @@ *

* import { getCurrent, LogicalSize } from '@tauri-apps/api/webview';
* await getCurrent().setSize(new LogicalSize(600, 500));
* await getCurrentWebview().setSize(new LogicalSize(600, 500));
* ```

@@ -272,3 +270,3 @@ *

* import { getCurrent, LogicalPosition } from '@tauri-apps/api/webview';
* await getCurrent().setPosition(new LogicalPosition(600, 500));
* await getCurrentWebview().setPosition(new LogicalPosition(600, 500));
* ```

@@ -284,4 +282,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* await getCurrent().setFocus();
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* await getCurrentWebview().setFocus();
* ```

@@ -296,4 +294,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* await getCurrent().setZoom(1.5);
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* await getCurrentWebview().setZoom(1.5);
* ```

@@ -308,4 +306,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* await getCurrent().reparent('other-window');
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* await getCurrentWebview().reparent('other-window');
* ```

@@ -324,3 +322,3 @@ *

* import { getCurrent } from "@tauri-apps/api/webview";
* const unlisten = await getCurrent().onDragDropEvent((event) => {
* const unlisten = await getCurrentWebview().onDragDropEvent((event) => {
* if (event.payload.type === 'hover') {

@@ -417,3 +415,3 @@ * console.log('User hovering', event.payload.paths);

}
export { Webview, getCurrent, getAll };
export type { DragDropEvent, DragDropPayload, WebviewOptions };
export { Webview, getCurrentWebview, getAllWebviews };
export type { DragDropEvent, WebviewOptions };
import { PhysicalPosition, PhysicalSize } from './dpi.js';
import { listen, once, emit, emitTo, TauriEvent } from './event.js';
import { invoke } from './core.js';
import { getCurrent as getCurrent$1, Window } from './window.js';
import { getCurrentWindow, Window } from './window.js';

@@ -16,4 +16,4 @@ // Copyright 2019-2024 Tauri Programme within The Commons Conservancy

* ```typescript
* import { getCurrent } from "@tauri-apps/api/webview";
* getCurrent().listen("my-webview-event", ({ event, payload }) => { });
* import { getCurrentWebview } from "@tauri-apps/api/webview";
* getCurrentWebview().listen("my-webview-event", ({ event, payload }) => { });
* ```

@@ -28,4 +28,4 @@ *

*/
function getCurrent() {
return new Webview(getCurrent$1(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
function getCurrentWebview() {
return new Webview(getCurrentWindow(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor

@@ -40,3 +40,3 @@ skip: true

*/
function getAll() {
function getAllWebviews() {
return window.__TAURI_INTERNALS__.metadata.webviews.map((w) => new Webview(Window.getByLabel(w.windowLabel), w.label, {

@@ -140,3 +140,3 @@ // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor

var _a;
return (_a = getAll().find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null;
return (_a = getAllWebviews().find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null;
}

@@ -147,3 +147,3 @@ /**

static getCurrent() {
return getCurrent();
return getCurrentWebview();
}

@@ -154,3 +154,3 @@ /**

static getAll() {
return getAll();
return getAllWebviews();
}

@@ -162,4 +162,4 @@ /**

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* const unlisten = await getCurrent().listen<string>('state-changed', (event) => {
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* const unlisten = await getCurrentWebview().listen<string>('state-changed', (event) => {
* console.log(`Got error: ${payload}`);

@@ -179,7 +179,7 @@ * });

if (this._handleTauriEvent(event, handler)) {
return Promise.resolve(() => {
return () => {
// eslint-disable-next-line security/detect-object-injection
const listeners = this.listeners[event];
listeners.splice(listeners.indexOf(handler), 1);
});
};
}

@@ -195,3 +195,3 @@ return listen(event, handler, {

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* const unlisten = await getCurrent().once<null>('initialized', (event) => {

@@ -212,7 +212,7 @@ * console.log(`Webview initialized!`);

if (this._handleTauriEvent(event, handler)) {
return Promise.resolve(() => {
return () => {
// eslint-disable-next-line security/detect-object-injection
const listeners = this.listeners[event];
listeners.splice(listeners.indexOf(handler), 1);
});
};
}

@@ -228,4 +228,4 @@ return once(event, handler, {

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* await getCurrent().emit('webview-loaded', { loggedIn: true, token: 'authToken' });
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* await getCurrentWebview().emit('webview-loaded', { loggedIn: true, token: 'authToken' });
* ```

@@ -246,3 +246,3 @@ *

}
return Promise.resolve();
return;
}

@@ -256,4 +256,4 @@ return emit(event, payload);

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* await getCurrent().emitTo('main', 'webview-loaded', { loggedIn: true, token: 'authToken' });
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* await getCurrentWebview().emitTo('main', 'webview-loaded', { loggedIn: true, token: 'authToken' });
* ```

@@ -275,3 +275,3 @@ *

}
return Promise.resolve();
return;
}

@@ -284,7 +284,7 @@ return emitTo(target, event, payload);

if (!(event in this.listeners)) {
// eslint-disable-next-line
// eslint-disable-next-line security/detect-object-injection
this.listeners[event] = [handler];
}
else {
// eslint-disable-next-line
// eslint-disable-next-line security/detect-object-injection
this.listeners[event].push(handler);

@@ -301,4 +301,4 @@ }

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* const position = await getCurrent().position();
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* const position = await getCurrentWebview().position();
* ```

@@ -318,4 +318,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* const size = await getCurrent().size();
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* const size = await getCurrentWebview().size();
* ```

@@ -335,4 +335,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* await getCurrent().close();
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* await getCurrentWebview().close();
* ```

@@ -352,3 +352,3 @@ *

* import { getCurrent, LogicalSize } from '@tauri-apps/api/webview';
* await getCurrent().setSize(new LogicalSize(600, 500));
* await getCurrentWebview().setSize(new LogicalSize(600, 500));
* ```

@@ -378,3 +378,3 @@ *

* import { getCurrent, LogicalPosition } from '@tauri-apps/api/webview';
* await getCurrent().setPosition(new LogicalPosition(600, 500));
* await getCurrentWebview().setPosition(new LogicalPosition(600, 500));
* ```

@@ -404,4 +404,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* await getCurrent().setFocus();
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* await getCurrentWebview().setFocus();
* ```

@@ -420,4 +420,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* await getCurrent().setZoom(1.5);
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* await getCurrentWebview().setZoom(1.5);
* ```

@@ -437,4 +437,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/webview';
* await getCurrent().reparent('other-window');
* import { getCurrentWebview } from '@tauri-apps/api/webview';
* await getCurrentWebview().reparent('other-window');
* ```

@@ -459,3 +459,3 @@ *

* import { getCurrent } from "@tauri-apps/api/webview";
* const unlisten = await getCurrent().onDragDropEvent((event) => {
* const unlisten = await getCurrentWebview().onDragDropEvent((event) => {
* if (event.payload.type === 'hover') {

@@ -478,7 +478,7 @@ * console.log('User hovering', event.payload.paths);

async onDragDropEvent(handler) {
const unlistenDrag = await this.listen(TauriEvent.DRAG, (event) => {
const unlistenDragEnter = await this.listen(TauriEvent.DRAG_ENTER, (event) => {
handler({
...event,
payload: {
type: 'dragged',
type: 'enter',
paths: event.payload.paths,

@@ -489,8 +489,7 @@ position: mapPhysicalPosition(event.payload.position)

});
const unlistenDrop = await this.listen(TauriEvent.DROP, (event) => {
const unlistenDragOver = await this.listen(TauriEvent.DRAG_OVER, (event) => {
handler({
...event,
payload: {
type: 'dropped',
paths: event.payload.paths,
type: 'over',
position: mapPhysicalPosition(event.payload.position)

@@ -500,7 +499,8 @@ }

});
const unlistenDragOver = await this.listen(TauriEvent.DROP_CANCELLED, (event) => {
const unlistenDragDrop = await this.listen(TauriEvent.DRAG_DROP, (event) => {
handler({
...event,
payload: {
type: 'dragOver',
type: 'drop',
paths: event.payload.paths,
position: mapPhysicalPosition(event.payload.position)

@@ -510,10 +510,10 @@ }

});
const unlistenCancel = await this.listen(TauriEvent.DROP_CANCELLED, (event) => {
handler({ ...event, payload: { type: 'cancelled' } });
const unlistenDragLeave = await this.listen(TauriEvent.DRAG_LEAVE, (event) => {
handler({ ...event, payload: { type: 'leave' } });
});
return () => {
unlistenDrag();
unlistenDrop();
unlistenDragEnter();
unlistenDragDrop();
unlistenDragOver();
unlistenCancel();
unlistenDragLeave();
};

@@ -526,2 +526,2 @@ }

export { Webview, getAll, getCurrent };
export { Webview, getAllWebviews, getCurrentWebview };

@@ -5,3 +5,3 @@ import { Webview, WebviewLabel, WebviewOptions } from './webview';

import type { EventName, EventCallback, UnlistenFn } from './event';
import type { DragDropEvent, DragDropPayload } from './webview';
import type { DragDropEvent } from './webview';
/**

@@ -12,3 +12,3 @@ * Get an instance of `Webview` for the current webview window.

*/
declare function getCurrent(): WebviewWindow;
declare function getCurrentWebviewWindow(): WebviewWindow;
/**

@@ -19,3 +19,3 @@ * Gets a list of instances of `Webview` for all available webview windows.

*/
declare function getAll(): WebviewWindow[];
declare function getAllWebviewWindows(): WebviewWindow[];
interface WebviewWindow extends Webview, Window {

@@ -106,5 +106,5 @@ }

*/
once<T>(event: string, handler: EventCallback<T>): Promise<UnlistenFn>;
once<T>(event: EventName, handler: EventCallback<T>): Promise<UnlistenFn>;
}
export { WebviewWindow, getCurrent, getAll };
export type { DragDropEvent, DragDropPayload };
export { WebviewWindow, getCurrentWebviewWindow, getAllWebviewWindows };
export type { DragDropEvent };

@@ -1,2 +0,2 @@

import { getCurrent as getCurrent$1, Webview } from './webview.js';
import { getCurrentWebview, Webview } from './webview.js';
import { Window } from './window.js';

@@ -14,4 +14,4 @@ import { listen, once } from './event.js';

*/
function getCurrent() {
const webview = getCurrent$1();
function getCurrentWebviewWindow() {
const webview = getCurrentWebview();
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor

@@ -25,3 +25,3 @@ return new WebviewWindow(webview.label, { skip: true });

*/
function getAll() {
function getAllWebviewWindows() {
return window.__TAURI_INTERNALS__.metadata.webviews.map((w) => new WebviewWindow(w.label, {

@@ -86,3 +86,3 @@ // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor

var _a;
const webview = (_a = getAll().find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null;
const webview = (_a = getAllWebviewWindows().find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null;
if (webview) {

@@ -98,3 +98,3 @@ // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor

static getCurrent() {
return getCurrent();
return getCurrentWebviewWindow();
}

@@ -105,4 +105,5 @@ /**

static getAll() {
return getAllWebviewWindows().map(
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
return getAll().map((w) => new WebviewWindow(w.label, { skip: true }));
(w) => new WebviewWindow(w.label, { skip: true }));
}

@@ -130,7 +131,7 @@ /**

if (this._handleTauriEvent(event, handler)) {
return Promise.resolve(() => {
return () => {
// eslint-disable-next-line security/detect-object-injection
const listeners = this.listeners[event];
listeners.splice(listeners.indexOf(handler), 1);
});
};
}

@@ -162,7 +163,7 @@ return listen(event, handler, {

if (this._handleTauriEvent(event, handler)) {
return Promise.resolve(() => {
return () => {
// eslint-disable-next-line security/detect-object-injection
const listeners = this.listeners[event];
listeners.splice(listeners.indexOf(handler), 1);
});
};
}

@@ -194,2 +195,2 @@ return once(event, handler, {

export { WebviewWindow, getAll, getCurrent };
export { WebviewWindow, getAllWebviewWindows, getCurrentWebviewWindow };

@@ -8,4 +8,4 @@ /**

* ```typescript
* import { getCurrent } from "@tauri-apps/api/window";
* getCurrent().listen("my-window-event", ({ event, payload }) => { });
* import { getCurrentWindow } from "@tauri-apps/api/window";
* getCurrentWindow().listen("my-window-event", ({ event, payload }) => { });
* ```

@@ -19,3 +19,3 @@ *

import { WebviewWindow } from './webviewWindow';
import type { DragDropEvent, DragDropPayload } from './webview';
import type { DragDropEvent } from './webview';
import { Image } from './image';

@@ -76,3 +76,3 @@ /**

private _preventDefault;
constructor(event: Event<null>);
constructor(event: Event<unknown>);
preventDefault(): void;

@@ -119,3 +119,3 @@ isPreventDefault(): boolean;

*/
declare function getCurrent(): Window;
declare function getCurrentWindow(): Window;
/**

@@ -126,3 +126,3 @@ * Gets a list of instances of `Window` for all available windows.

*/
declare function getAll(): Window[];
declare function getAllWindows(): Window[];
/** @ignore */

@@ -217,4 +217,4 @@ export type WindowLabel = string;

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const unlisten = await getCurrent().listen<string>('state-changed', (event) => {
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const unlisten = await getCurrentWindow().listen<string>('state-changed', (event) => {
* console.log(`Got error: ${payload}`);

@@ -238,4 +238,4 @@ * });

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const unlisten = await getCurrent().once<null>('initialized', (event) => {
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const unlisten = await getCurrentWindow().once<null>('initialized', (event) => {
* console.log(`Window initialized!`);

@@ -253,3 +253,3 @@ * });

*/
once<T>(event: string, handler: EventCallback<T>): Promise<UnlistenFn>;
once<T>(event: EventName, handler: EventCallback<T>): Promise<UnlistenFn>;
/**

@@ -259,4 +259,4 @@ * Emits an event to all {@link EventTarget|targets}.

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().emit('window-loaded', { loggedIn: true, token: 'authToken' });
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().emit('window-loaded', { loggedIn: true, token: 'authToken' });
* ```

@@ -273,4 +273,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().emit('main', 'window-loaded', { loggedIn: true, token: 'authToken' });
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().emit('main', 'window-loaded', { loggedIn: true, token: 'authToken' });
* ```

@@ -288,4 +288,4 @@ * @param target Label of the target Window/Webview/WebviewWindow or raw {@link EventTarget} object.

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const factor = await getCurrent().scaleFactor();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const factor = await getCurrentWindow().scaleFactor();
* ```

@@ -300,4 +300,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const position = await getCurrent().innerPosition();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const position = await getCurrentWindow().innerPosition();
* ```

@@ -312,4 +312,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const position = await getCurrent().outerPosition();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const position = await getCurrentWindow().outerPosition();
* ```

@@ -325,4 +325,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const size = await getCurrent().innerSize();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const size = await getCurrentWindow().innerSize();
* ```

@@ -338,4 +338,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const size = await getCurrent().outerSize();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const size = await getCurrentWindow().outerSize();
* ```

@@ -350,4 +350,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const fullscreen = await getCurrent().isFullscreen();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const fullscreen = await getCurrentWindow().isFullscreen();
* ```

@@ -362,4 +362,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const minimized = await getCurrent().isMinimized();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const minimized = await getCurrentWindow().isMinimized();
* ```

@@ -372,4 +372,4 @@ */

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const maximized = await getCurrent().isMaximized();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const maximized = await getCurrentWindow().isMaximized();
* ```

@@ -384,4 +384,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const focused = await getCurrent().isFocused();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const focused = await getCurrentWindow().isFocused();
* ```

@@ -396,4 +396,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const decorated = await getCurrent().isDecorated();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const decorated = await getCurrentWindow().isDecorated();
* ```

@@ -408,4 +408,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const resizable = await getCurrent().isResizable();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const resizable = await getCurrentWindow().isResizable();
* ```

@@ -425,4 +425,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const maximizable = await getCurrent().isMaximizable();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const maximizable = await getCurrentWindow().isMaximizable();
* ```

@@ -442,4 +442,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const minimizable = await getCurrent().isMinimizable();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const minimizable = await getCurrentWindow().isMinimizable();
* ```

@@ -459,4 +459,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const closable = await getCurrent().isClosable();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const closable = await getCurrentWindow().isClosable();
* ```

@@ -471,4 +471,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const visible = await getCurrent().isVisible();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const visible = await getCurrentWindow().isVisible();
* ```

@@ -483,4 +483,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const title = await getCurrent().title();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const title = await getCurrentWindow().title();
* ```

@@ -498,4 +498,4 @@ */

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const theme = await getCurrent().theme();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const theme = await getCurrentWindow().theme();
* ```

@@ -510,4 +510,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().center();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().center();
* ```

@@ -532,4 +532,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().requestUserAttention();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().requestUserAttention();
* ```

@@ -544,4 +544,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setResizable(false);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setResizable(false);
* ```

@@ -563,4 +563,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setMaximizable(false);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setMaximizable(false);
* ```

@@ -580,4 +580,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setMinimizable(false);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setMinimizable(false);
* ```

@@ -598,4 +598,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setClosable(false);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setClosable(false);
* ```

@@ -610,4 +610,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setTitle('Tauri');
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setTitle('Tauri');
* ```

@@ -623,4 +623,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().maximize();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().maximize();
* ```

@@ -635,4 +635,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().unmaximize();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().unmaximize();
* ```

@@ -647,4 +647,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().toggleMaximize();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().toggleMaximize();
* ```

@@ -659,4 +659,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().minimize();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().minimize();
* ```

@@ -671,4 +671,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().unminimize();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().unminimize();
* ```

@@ -683,4 +683,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().show();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().show();
* ```

@@ -695,4 +695,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().hide();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().hide();
* ```

@@ -709,4 +709,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().close();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().close();
* ```

@@ -721,4 +721,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().destroy();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().destroy();
* ```

@@ -733,4 +733,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setDecorations(false);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setDecorations(false);
* ```

@@ -755,4 +755,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setShadow(false);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setShadow(false);
* ```

@@ -775,4 +775,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setAlwaysOnTop(true);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setAlwaysOnTop(true);
* ```

@@ -788,4 +788,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setAlwaysOnBottom(true);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setAlwaysOnBottom(true);
* ```

@@ -801,4 +801,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setContentProtected(true);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setContentProtected(true);
* ```

@@ -813,4 +813,4 @@ *

* ```typescript
* import { getCurrent, LogicalSize } from '@tauri-apps/api/window';
* await getCurrent().setSize(new LogicalSize(600, 500));
* import { getCurrentWindow, LogicalSize } from '@tauri-apps/api/window';
* await getCurrentWindow().setSize(new LogicalSize(600, 500));
* ```

@@ -826,4 +826,4 @@ *

* ```typescript
* import { getCurrent, PhysicalSize } from '@tauri-apps/api/window';
* await getCurrent().setMinSize(new PhysicalSize(600, 500));
* import { getCurrentWindow, PhysicalSize } from '@tauri-apps/api/window';
* await getCurrentWindow().setMinSize(new PhysicalSize(600, 500));
* ```

@@ -839,4 +839,4 @@ *

* ```typescript
* import { getCurrent, LogicalSize } from '@tauri-apps/api/window';
* await getCurrent().setMaxSize(new LogicalSize(600, 500));
* import { getCurrentWindow, LogicalSize } from '@tauri-apps/api/window';
* await getCurrentWindow().setMaxSize(new LogicalSize(600, 500));
* ```

@@ -852,4 +852,4 @@ *

* ```typescript
* import { getCurrent, LogicalPosition } from '@tauri-apps/api/window';
* await getCurrent().setPosition(new LogicalPosition(600, 500));
* import { getCurrentWindow, LogicalPosition } from '@tauri-apps/api/window';
* await getCurrentWindow().setPosition(new LogicalPosition(600, 500));
* ```

@@ -865,4 +865,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setFullscreen(true);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setFullscreen(true);
* ```

@@ -878,4 +878,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setFocus();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setFocus();
* ```

@@ -890,4 +890,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setIcon('/tauri/awesome.png');
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setIcon('/tauri/awesome.png');
* ```

@@ -914,4 +914,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setSkipTaskbar(true);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setSkipTaskbar(true);
* ```

@@ -935,4 +935,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setCursorGrab(true);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setCursorGrab(true);
* ```

@@ -954,4 +954,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setCursorVisible(false);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setCursorVisible(false);
* ```

@@ -967,4 +967,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setCursorIcon('help');
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setCursorIcon('help');
* ```

@@ -980,4 +980,4 @@ *

* ```typescript
* import { getCurrent, LogicalPosition } from '@tauri-apps/api/window';
* await getCurrent().setCursorPosition(new LogicalPosition(600, 300));
* import { getCurrentWindow, LogicalPosition } from '@tauri-apps/api/window';
* await getCurrentWindow().setCursorPosition(new LogicalPosition(600, 300));
* ```

@@ -994,4 +994,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setIgnoreCursorEvents(true);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setIgnoreCursorEvents(true);
* ```

@@ -1007,4 +1007,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().startDragging();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().startDragging();
* ```

@@ -1019,4 +1019,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().startResizeDragging();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().startResizeDragging();
* ```

@@ -1037,4 +1037,4 @@ *

* ```typescript
* import { getCurrent, ProgressBarStatus } from '@tauri-apps/api/window';
* await getCurrent().setProgressBar({
* import { getCurrentWindow, ProgressBarStatus } from '@tauri-apps/api/window';
* await getCurrentWindow().setProgressBar({
* status: ProgressBarStatus.Normal,

@@ -1059,2 +1059,8 @@ * progress: 50,

/**
* Sets the title bar style. **macOS only**.
*
* @since 2.0.0
*/
setTitleBarStyle(style: TitleBarStyle): Promise<void>;
/**
* Listen to window resize.

@@ -1064,4 +1070,4 @@ *

* ```typescript
* import { getCurrent } from "@tauri-apps/api/window";
* const unlisten = await getCurrent().onResized(({ payload: size }) => {
* import { getCurrentWindow } from "@tauri-apps/api/window";
* const unlisten = await getCurrentWindow().onResized(({ payload: size }) => {
* console.log('Window resized', size);

@@ -1083,4 +1089,4 @@ * });

* ```typescript
* import { getCurrent } from "@tauri-apps/api/window";
* const unlisten = await getCurrent().onMoved(({ payload: position }) => {
* import { getCurrentWindow } from "@tauri-apps/api/window";
* const unlisten = await getCurrentWindow().onMoved(({ payload: position }) => {
* console.log('Window moved', position);

@@ -1102,5 +1108,5 @@ * });

* ```typescript
* import { getCurrent } from "@tauri-apps/api/window";
* import { getCurrentWindow } from "@tauri-apps/api/window";
* import { confirm } from '@tauri-apps/api/dialog';
* const unlisten = await getCurrent().onCloseRequested(async (event) => {
* const unlisten = await getCurrentWindow().onCloseRequested(async (event) => {
* const confirmed = await confirm('Are you sure?');

@@ -1128,4 +1134,4 @@ * if (!confirmed) {

* ```typescript
* import { getCurrent } from "@tauri-apps/api/webview";
* const unlisten = await getCurrent().onDragDropEvent((event) => {
* import { getCurrentWindow } from "@tauri-apps/api/webview";
* const unlisten = await getCurrentWindow().onDragDropEvent((event) => {
* if (event.payload.type === 'hover') {

@@ -1153,4 +1159,4 @@ * console.log('User hovering', event.payload.paths);

* ```typescript
* import { getCurrent } from "@tauri-apps/api/window";
* const unlisten = await getCurrent().onFocusChanged(({ payload: focused }) => {
* import { getCurrentWindow } from "@tauri-apps/api/window";
* const unlisten = await getCurrentWindow().onFocusChanged(({ payload: focused }) => {
* console.log('Focus changed, window is focused? ' + focused);

@@ -1176,4 +1182,4 @@ * });

* ```typescript
* import { getCurrent } from "@tauri-apps/api/window";
* const unlisten = await getCurrent().onScaleChanged(({ payload }) => {
* import { getCurrentWindow } from "@tauri-apps/api/window";
* const unlisten = await getCurrentWindow().onScaleChanged(({ payload }) => {
* console.log('Scale changed', payload.scaleFactor, payload.size);

@@ -1195,4 +1201,4 @@ * });

* ```typescript
* import { getCurrent } from "@tauri-apps/api/window";
* const unlisten = await getCurrent().onThemeChanged(({ payload: theme }) => {
* import { getCurrentWindow } from "@tauri-apps/api/window";
* const unlisten = await getCurrentWindow().onThemeChanged(({ payload: theme }) => {
* console.log('New theme: ' + theme);

@@ -1566,3 +1572,3 @@ * });

declare function cursorPosition(): Promise<PhysicalPosition>;
export { Window, CloseRequestedEvent, getCurrent, getAll, LogicalSize, PhysicalSize, LogicalPosition, PhysicalPosition, UserAttentionType, Effect, EffectState, currentMonitor, monitorFromPoint, primaryMonitor, availableMonitors, cursorPosition };
export type { Effects, Theme, TitleBarStyle, ScaleFactorChanged, WindowOptions, Color, DragDropEvent, DragDropPayload };
export { Window, CloseRequestedEvent, getCurrentWindow, getAllWindows, LogicalSize, PhysicalSize, LogicalPosition, PhysicalPosition, UserAttentionType, Effect, EffectState, currentMonitor, monitorFromPoint, primaryMonitor, availableMonitors, cursorPosition };
export type { Effects, Theme, TitleBarStyle, ScaleFactorChanged, WindowOptions, Color, DragDropEvent };

@@ -17,4 +17,4 @@ import { PhysicalPosition, PhysicalSize } from './dpi.js';

* ```typescript
* import { getCurrent } from "@tauri-apps/api/window";
* getCurrent().listen("my-window-event", ({ event, payload }) => { });
* import { getCurrentWindow } from "@tauri-apps/api/window";
* getCurrentWindow().listen("my-window-event", ({ event, payload }) => { });
* ```

@@ -85,3 +85,3 @@ *

*/
function getCurrent() {
function getCurrentWindow() {
return new Window(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {

@@ -97,3 +97,3 @@ // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor

*/
function getAll() {
function getAllWindows() {
return window.__TAURI_INTERNALS__.metadata.windows.map((w) => new Window(w.label, {

@@ -186,3 +186,3 @@ // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor

var _a;
return (_a = getAll().find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null;
return (_a = getAllWindows().find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null;
}

@@ -193,3 +193,3 @@ /**

static getCurrent() {
return getCurrent();
return getCurrentWindow();
}

@@ -200,3 +200,3 @@ /**

static getAll() {
return getAll();
return getAllWindows();
}

@@ -214,3 +214,3 @@ /**

static async getFocusedWindow() {
for (const w of getAll()) {
for (const w of getAllWindows()) {
if (await w.isFocused()) {

@@ -227,4 +227,4 @@ return w;

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const unlisten = await getCurrent().listen<string>('state-changed', (event) => {
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const unlisten = await getCurrentWindow().listen<string>('state-changed', (event) => {
* console.log(`Got error: ${payload}`);

@@ -244,7 +244,7 @@ * });

if (this._handleTauriEvent(event, handler)) {
return Promise.resolve(() => {
return () => {
// eslint-disable-next-line security/detect-object-injection
const listeners = this.listeners[event];
listeners.splice(listeners.indexOf(handler), 1);
});
};
}

@@ -260,4 +260,4 @@ return listen(event, handler, {

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const unlisten = await getCurrent().once<null>('initialized', (event) => {
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const unlisten = await getCurrentWindow().once<null>('initialized', (event) => {
* console.log(`Window initialized!`);

@@ -277,7 +277,7 @@ * });

if (this._handleTauriEvent(event, handler)) {
return Promise.resolve(() => {
return () => {
// eslint-disable-next-line security/detect-object-injection
const listeners = this.listeners[event];
listeners.splice(listeners.indexOf(handler), 1);
});
};
}

@@ -292,4 +292,4 @@ return once(event, handler, {

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().emit('window-loaded', { loggedIn: true, token: 'authToken' });
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().emit('window-loaded', { loggedIn: true, token: 'authToken' });
* ```

@@ -310,3 +310,3 @@ *

}
return Promise.resolve();
return;
}

@@ -320,4 +320,4 @@ return emit(event, payload);

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().emit('main', 'window-loaded', { loggedIn: true, token: 'authToken' });
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().emit('main', 'window-loaded', { loggedIn: true, token: 'authToken' });
* ```

@@ -330,3 +330,3 @@ * @param target Label of the target Window/Webview/WebviewWindow or raw {@link EventTarget} object.

if (localTauriEvents.includes(event)) {
// eslint-disable-next-line
// eslint-disable-next-line security/detect-object-injection
for (const handler of this.listeners[event] || []) {

@@ -339,3 +339,3 @@ handler({

}
return Promise.resolve();
return;
}

@@ -364,4 +364,4 @@ return emitTo(target, event, payload);

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const factor = await getCurrent().scaleFactor();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const factor = await getCurrentWindow().scaleFactor();
* ```

@@ -380,4 +380,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const position = await getCurrent().innerPosition();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const position = await getCurrentWindow().innerPosition();
* ```

@@ -396,4 +396,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const position = await getCurrent().outerPosition();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const position = await getCurrentWindow().outerPosition();
* ```

@@ -413,4 +413,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const size = await getCurrent().innerSize();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const size = await getCurrentWindow().innerSize();
* ```

@@ -430,4 +430,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const size = await getCurrent().outerSize();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const size = await getCurrentWindow().outerSize();
* ```

@@ -446,4 +446,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const fullscreen = await getCurrent().isFullscreen();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const fullscreen = await getCurrentWindow().isFullscreen();
* ```

@@ -462,4 +462,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const minimized = await getCurrent().isMinimized();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const minimized = await getCurrentWindow().isMinimized();
* ```

@@ -476,4 +476,4 @@ */

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const maximized = await getCurrent().isMaximized();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const maximized = await getCurrentWindow().isMaximized();
* ```

@@ -492,4 +492,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const focused = await getCurrent().isFocused();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const focused = await getCurrentWindow().isFocused();
* ```

@@ -508,4 +508,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const decorated = await getCurrent().isDecorated();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const decorated = await getCurrentWindow().isDecorated();
* ```

@@ -524,4 +524,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const resizable = await getCurrent().isResizable();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const resizable = await getCurrentWindow().isResizable();
* ```

@@ -545,4 +545,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const maximizable = await getCurrent().isMaximizable();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const maximizable = await getCurrentWindow().isMaximizable();
* ```

@@ -566,4 +566,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const minimizable = await getCurrent().isMinimizable();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const minimizable = await getCurrentWindow().isMinimizable();
* ```

@@ -587,4 +587,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const closable = await getCurrent().isClosable();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const closable = await getCurrentWindow().isClosable();
* ```

@@ -603,4 +603,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const visible = await getCurrent().isVisible();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const visible = await getCurrentWindow().isVisible();
* ```

@@ -619,4 +619,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const title = await getCurrent().title();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const title = await getCurrentWindow().title();
* ```

@@ -638,4 +638,4 @@ */

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* const theme = await getCurrent().theme();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* const theme = await getCurrentWindow().theme();
* ```

@@ -655,4 +655,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().center();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().center();
* ```

@@ -681,4 +681,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().requestUserAttention();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().requestUserAttention();
* ```

@@ -707,4 +707,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setResizable(false);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setResizable(false);
* ```

@@ -731,4 +731,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setMaximizable(false);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setMaximizable(false);
* ```

@@ -753,4 +753,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setMinimizable(false);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setMinimizable(false);
* ```

@@ -776,4 +776,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setClosable(false);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setClosable(false);
* ```

@@ -793,4 +793,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setTitle('Tauri');
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setTitle('Tauri');
* ```

@@ -811,4 +811,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().maximize();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().maximize();
* ```

@@ -827,4 +827,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().unmaximize();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().unmaximize();
* ```

@@ -843,4 +843,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().toggleMaximize();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().toggleMaximize();
* ```

@@ -859,4 +859,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().minimize();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().minimize();
* ```

@@ -875,4 +875,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().unminimize();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().unminimize();
* ```

@@ -891,4 +891,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().show();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().show();
* ```

@@ -907,4 +907,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().hide();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().hide();
* ```

@@ -925,4 +925,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().close();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().close();
* ```

@@ -941,4 +941,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().destroy();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().destroy();
* ```

@@ -957,4 +957,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setDecorations(false);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setDecorations(false);
* ```

@@ -984,4 +984,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setShadow(false);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setShadow(false);
* ```

@@ -1019,4 +1019,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setAlwaysOnTop(true);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setAlwaysOnTop(true);
* ```

@@ -1037,4 +1037,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setAlwaysOnBottom(true);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setAlwaysOnBottom(true);
* ```

@@ -1055,4 +1055,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setContentProtected(true);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setContentProtected(true);
* ```

@@ -1072,4 +1072,4 @@ *

* ```typescript
* import { getCurrent, LogicalSize } from '@tauri-apps/api/window';
* await getCurrent().setSize(new LogicalSize(600, 500));
* import { getCurrentWindow, LogicalSize } from '@tauri-apps/api/window';
* await getCurrentWindow().setSize(new LogicalSize(600, 500));
* ```

@@ -1098,4 +1098,4 @@ *

* ```typescript
* import { getCurrent, PhysicalSize } from '@tauri-apps/api/window';
* await getCurrent().setMinSize(new PhysicalSize(600, 500));
* import { getCurrentWindow, PhysicalSize } from '@tauri-apps/api/window';
* await getCurrentWindow().setMinSize(new PhysicalSize(600, 500));
* ```

@@ -1127,4 +1127,4 @@ *

* ```typescript
* import { getCurrent, LogicalSize } from '@tauri-apps/api/window';
* await getCurrent().setMaxSize(new LogicalSize(600, 500));
* import { getCurrentWindow, LogicalSize } from '@tauri-apps/api/window';
* await getCurrentWindow().setMaxSize(new LogicalSize(600, 500));
* ```

@@ -1156,4 +1156,4 @@ *

* ```typescript
* import { getCurrent, LogicalPosition } from '@tauri-apps/api/window';
* await getCurrent().setPosition(new LogicalPosition(600, 500));
* import { getCurrentWindow, LogicalPosition } from '@tauri-apps/api/window';
* await getCurrentWindow().setPosition(new LogicalPosition(600, 500));
* ```

@@ -1183,4 +1183,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setFullscreen(true);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setFullscreen(true);
* ```

@@ -1201,4 +1201,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setFocus();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setFocus();
* ```

@@ -1217,4 +1217,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setIcon('/tauri/awesome.png');
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setIcon('/tauri/awesome.png');
* ```

@@ -1246,4 +1246,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setSkipTaskbar(true);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setSkipTaskbar(true);
* ```

@@ -1272,4 +1272,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setCursorGrab(true);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setCursorGrab(true);
* ```

@@ -1296,4 +1296,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setCursorVisible(false);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setCursorVisible(false);
* ```

@@ -1314,4 +1314,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setCursorIcon('help');
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setCursorIcon('help');
* ```

@@ -1332,4 +1332,4 @@ *

* ```typescript
* import { getCurrent, LogicalPosition } from '@tauri-apps/api/window';
* await getCurrent().setCursorPosition(new LogicalPosition(600, 300));
* import { getCurrentWindow, LogicalPosition } from '@tauri-apps/api/window';
* await getCurrentWindow().setCursorPosition(new LogicalPosition(600, 300));
* ```

@@ -1360,4 +1360,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().setIgnoreCursorEvents(true);
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().setIgnoreCursorEvents(true);
* ```

@@ -1378,4 +1378,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().startDragging();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().startDragging();
* ```

@@ -1394,4 +1394,4 @@ *

* ```typescript
* import { getCurrent } from '@tauri-apps/api/window';
* await getCurrent().startResizeDragging();
* import { getCurrentWindow } from '@tauri-apps/api/window';
* await getCurrentWindow().startResizeDragging();
* ```

@@ -1417,4 +1417,4 @@ *

* ```typescript
* import { getCurrent, ProgressBarStatus } from '@tauri-apps/api/window';
* await getCurrent().setProgressBar({
* import { getCurrentWindow, ProgressBarStatus } from '@tauri-apps/api/window';
* await getCurrentWindow().setProgressBar({
* status: ProgressBarStatus.Normal,

@@ -1448,2 +1448,13 @@ * progress: 50,

}
/**
* Sets the title bar style. **macOS only**.
*
* @since 2.0.0
*/
async setTitleBarStyle(style) {
return invoke('plugin:window|set_title_bar_style', {
label: this.label,
value: style
});
}
// Listeners

@@ -1455,4 +1466,4 @@ /**

* ```typescript
* import { getCurrent } from "@tauri-apps/api/window";
* const unlisten = await getCurrent().onResized(({ payload: size }) => {
* import { getCurrentWindow } from "@tauri-apps/api/window";
* const unlisten = await getCurrentWindow().onResized(({ payload: size }) => {
* console.log('Window resized', size);

@@ -1479,4 +1490,4 @@ * });

* ```typescript
* import { getCurrent } from "@tauri-apps/api/window";
* const unlisten = await getCurrent().onMoved(({ payload: position }) => {
* import { getCurrentWindow } from "@tauri-apps/api/window";
* const unlisten = await getCurrentWindow().onMoved(({ payload: position }) => {
* console.log('Window moved', position);

@@ -1503,5 +1514,5 @@ * });

* ```typescript
* import { getCurrent } from "@tauri-apps/api/window";
* import { getCurrentWindow } from "@tauri-apps/api/window";
* import { confirm } from '@tauri-apps/api/dialog';
* const unlisten = await getCurrent().onCloseRequested(async (event) => {
* const unlisten = await getCurrentWindow().onCloseRequested(async (event) => {
* const confirmed = await confirm('Are you sure?');

@@ -1522,9 +1533,9 @@ * if (!confirmed) {

async onCloseRequested(handler) {
return this.listen(TauriEvent.WINDOW_CLOSE_REQUESTED, (event) => {
// eslint-disable-next-line @typescript-eslint/no-misused-promises
return this.listen(TauriEvent.WINDOW_CLOSE_REQUESTED, async (event) => {
const evt = new CloseRequestedEvent(event);
void Promise.resolve(handler(evt)).then(() => {
if (!evt.isPreventDefault()) {
return this.destroy();
}
});
await handler(evt);
if (!evt.isPreventDefault()) {
await this.destroy();
}
});

@@ -1539,4 +1550,4 @@ }

* ```typescript
* import { getCurrent } from "@tauri-apps/api/webview";
* const unlisten = await getCurrent().onDragDropEvent((event) => {
* import { getCurrentWindow } from "@tauri-apps/api/webview";
* const unlisten = await getCurrentWindow().onDragDropEvent((event) => {
* if (event.payload.type === 'hover') {

@@ -1559,7 +1570,7 @@ * console.log('User hovering', event.payload.paths);

async onDragDropEvent(handler) {
const unlistenDrag = await this.listen(TauriEvent.DRAG, (event) => {
const unlistenDrag = await this.listen(TauriEvent.DRAG_ENTER, (event) => {
handler({
...event,
payload: {
type: 'dragged',
type: 'enter',
paths: event.payload.paths,

@@ -1570,8 +1581,7 @@ position: mapPhysicalPosition(event.payload.position)

});
const unlistenDrop = await this.listen(TauriEvent.DROP, (event) => {
const unlistenDragOver = await this.listen(TauriEvent.DRAG_OVER, (event) => {
handler({
...event,
payload: {
type: 'dropped',
paths: event.payload.paths,
type: 'over',
position: mapPhysicalPosition(event.payload.position)

@@ -1581,7 +1591,8 @@ }

});
const unlistenDragOver = await this.listen(TauriEvent.DROP_OVER, (event) => {
const unlistenDrop = await this.listen(TauriEvent.DRAG_DROP, (event) => {
handler({
...event,
payload: {
type: 'dragOver',
type: 'drop',
paths: event.payload.paths,
position: mapPhysicalPosition(event.payload.position)

@@ -1591,4 +1602,4 @@ }

});
const unlistenCancel = await this.listen(TauriEvent.DROP_CANCELLED, (event) => {
handler({ ...event, payload: { type: 'cancelled' } });
const unlistenCancel = await this.listen(TauriEvent.DRAG_LEAVE, (event) => {
handler({ ...event, payload: { type: 'leave' } });
});

@@ -1607,4 +1618,4 @@ return () => {

* ```typescript
* import { getCurrent } from "@tauri-apps/api/window";
* const unlisten = await getCurrent().onFocusChanged(({ payload: focused }) => {
* import { getCurrentWindow } from "@tauri-apps/api/window";
* const unlisten = await getCurrentWindow().onFocusChanged(({ payload: focused }) => {
* console.log('Focus changed, window is focused? ' + focused);

@@ -1641,4 +1652,4 @@ * });

* ```typescript
* import { getCurrent } from "@tauri-apps/api/window";
* const unlisten = await getCurrent().onScaleChanged(({ payload }) => {
* import { getCurrentWindow } from "@tauri-apps/api/window";
* const unlisten = await getCurrentWindow().onScaleChanged(({ payload }) => {
* console.log('Scale changed', payload.scaleFactor, payload.size);

@@ -1662,4 +1673,4 @@ * });

* ```typescript
* import { getCurrent } from "@tauri-apps/api/window";
* const unlisten = await getCurrent().onThemeChanged(({ payload: theme }) => {
* import { getCurrentWindow } from "@tauri-apps/api/window";
* const unlisten = await getCurrentWindow().onThemeChanged(({ payload: theme }) => {
* console.log('New theme: ' + theme);

@@ -1914,2 +1925,2 @@ * });

export { CloseRequestedEvent, Effect, EffectState, PhysicalPosition, PhysicalSize, ProgressBarStatus, UserAttentionType, Window, availableMonitors, currentMonitor, cursorPosition, getAll, getCurrent, monitorFromPoint, primaryMonitor };
export { CloseRequestedEvent, Effect, EffectState, PhysicalPosition, PhysicalSize, ProgressBarStatus, UserAttentionType, Window, availableMonitors, currentMonitor, cursorPosition, getAllWindows, getCurrentWindow, monitorFromPoint, primaryMonitor };

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc