feat(window): refactor and improvements (#426)

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
Amr Bashir
2023-08-07 13:20:17 -03:00
committed by GitHub
co-authored by Lucas Nogueira
parent 5b3210c224
commit 84133b57b8
8 changed files with 323 additions and 330 deletions
+3 -1
View File
@@ -1,8 +1,10 @@
<script>
import { appWindow } from "@tauri-apps/plugin-window";
import { getCurrent } from "@tauri-apps/plugin-window";
import { invoke } from "@tauri-apps/api/tauri";
import { onMount, onDestroy } from "svelte";
const appWindow = getCurrent();
export let onMessage;
let unlisten;
+5 -3
View File
@@ -1,17 +1,19 @@
<script>
import {
appWindow,
WebviewWindow,
getCurrent,
LogicalSize,
UserAttentionType,
PhysicalSize,
PhysicalPosition,
Effect,
EffectState,
Window
} from "@tauri-apps/plugin-window";
import { open as openDialog } from "@tauri-apps/plugin-dialog";
import { open } from "@tauri-apps/plugin-shell";
const appWindow = getCurrent();
let selectedWindow = appWindow.label;
const windowMap = {
[appWindow.label]: appWindow,
@@ -146,7 +148,7 @@
function createWindow() {
if (!newWindowLabel) return;
const webview = new WebviewWindow(newWindowLabel);
const webview = new Window(newWindowLabel);
windowMap[newWindowLabel] = webview;
webview.once("tauri://error", function () {
onMessage("Error creating new webview");