Преглед на файлове

fix(api): global bundle broken code, closes #2289 (#2297)

Lucas Fernandes Nogueira преди 4 години
родител
ревизия
268450b132
променени са 3 файла, в които са добавени 9 реда и са изтрити 4 реда
  1. 5 0
      .changes/fix-global-tauri.md
  2. 0 0
      core/tauri/scripts/bundle.js
  3. 4 4
      tooling/api/src/window.ts

+ 5 - 0
.changes/fix-global-tauri.md

@@ -0,0 +1,5 @@
+---
+"api": patch
+---
+
+Fixes the global bundle UMD code.

Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
core/tauri/scripts/bundle.js


+ 4 - 4
tooling/api/src/window.ts

@@ -225,11 +225,11 @@ const localTauriEvents = ['tauri://created', 'tauri://error']
  */
 class WebviewWindowHandle {
   /** Window label. */
-  label: string
+  label: string | null
   /** Local event listeners. */
   listeners: { [key: string]: Array<EventCallback<any>> }
 
-  constructor(label: string) {
+  constructor(label: string | null) {
     this.label = label
     // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
     this.listeners = Object.create(null)
@@ -1071,7 +1071,7 @@ class WindowManager extends WebviewWindowHandle {
  * ```
  */
 class WebviewWindow extends WindowManager {
-  constructor(label: string, options: WindowOptions = {}) {
+  constructor(label: string | null, options: WindowOptions = {}) {
     super(label)
     // @ts-expect-error
     if (!options?.skip) {
@@ -1108,7 +1108,7 @@ class WebviewWindow extends WindowManager {
 }
 
 /** The WebviewWindow for the current window. */
-const appWindow = new WebviewWindow(window.__TAURI__.__currentWindow.label, {
+const appWindow = new WebviewWindow(null, {
   // @ts-expect-error
   skip: true
 })

Някои файлове не бяха показани, защото твърде много файлове са промени