Skip to content

Commit 268450b

Browse files
authored
fix(api): global bundle broken code, closes #2289 (#2297)
1 parent 8216cba commit 268450b

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

.changes/fix-global-tauri.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"api": patch
3+
---
4+
5+
Fixes the global bundle UMD code.

core/tauri/scripts/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tooling/api/src/window.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,11 @@ const localTauriEvents = ['tauri://created', 'tauri://error']
225225
*/
226226
class WebviewWindowHandle {
227227
/** Window label. */
228-
label: string
228+
label: string | null
229229
/** Local event listeners. */
230230
listeners: { [key: string]: Array<EventCallback<any>> }
231231

232-
constructor(label: string) {
232+
constructor(label: string | null) {
233233
this.label = label
234234
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
235235
this.listeners = Object.create(null)
@@ -1071,7 +1071,7 @@ class WindowManager extends WebviewWindowHandle {
10711071
* ```
10721072
*/
10731073
class WebviewWindow extends WindowManager {
1074-
constructor(label: string, options: WindowOptions = {}) {
1074+
constructor(label: string | null, options: WindowOptions = {}) {
10751075
super(label)
10761076
// @ts-expect-error
10771077
if (!options?.skip) {
@@ -1108,7 +1108,7 @@ class WebviewWindow extends WindowManager {
11081108
}
11091109

11101110
/** The WebviewWindow for the current window. */
1111-
const appWindow = new WebviewWindow(window.__TAURI__.__currentWindow.label, {
1111+
const appWindow = new WebviewWindow(null, {
11121112
// @ts-expect-error
11131113
skip: true
11141114
})

0 commit comments

Comments
 (0)