From 4c3cbc3535f8ceb8d440f8fef4a67c13d8ba8ea4 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Fri, 29 Dec 2023 11:15:40 +1100 Subject: [PATCH] Update Wails runtime and increase version The Wails runtime has been updated to correctly handle debug checks and the version in the package.json has been bumped to 3.0.0-alpha.6. Fixed reference to global wails object in WML. --- v3/internal/runtime/desktop/@wailsio/runtime/.npmignore | 1 + v3/internal/runtime/desktop/@wailsio/runtime/contextmenu.js | 4 +++- v3/internal/runtime/desktop/@wailsio/runtime/package.json | 5 +++-- v3/internal/runtime/desktop/@wailsio/runtime/system.js | 4 ++++ v3/internal/runtime/desktop/@wailsio/runtime/wml.js | 5 +++-- 5 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 v3/internal/runtime/desktop/@wailsio/runtime/.npmignore diff --git a/v3/internal/runtime/desktop/@wailsio/runtime/.npmignore b/v3/internal/runtime/desktop/@wailsio/runtime/.npmignore new file mode 100644 index 000000000..2e62d1757 --- /dev/null +++ b/v3/internal/runtime/desktop/@wailsio/runtime/.npmignore @@ -0,0 +1 @@ +events.test.js \ No newline at end of file diff --git a/v3/internal/runtime/desktop/@wailsio/runtime/contextmenu.js b/v3/internal/runtime/desktop/@wailsio/runtime/contextmenu.js index 935165435..dbe9d4253 100644 --- a/v3/internal/runtime/desktop/@wailsio/runtime/contextmenu.js +++ b/v3/internal/runtime/desktop/@wailsio/runtime/contextmenu.js @@ -11,6 +11,7 @@ The electron alternative for Go /* jshint esversion: 9 */ import {newRuntimeCallerWithID, objectNames} from "./runtime"; +import {IsDebug} from "./system"; const call = newRuntimeCallerWithID(objectNames.ContextMenu, ''); const ContextMenuOpen = 0; @@ -47,8 +48,9 @@ function contextMenuHandler(event) { This rule is inherited like normal CSS rules, so nesting works as expected */ function processDefaultContextMenu(event) { + // Debug builds always show the menu - if (DEBUG) { + if (IsDebug()) { return; } diff --git a/v3/internal/runtime/desktop/@wailsio/runtime/package.json b/v3/internal/runtime/desktop/@wailsio/runtime/package.json index 85b60557c..9b970ad86 100644 --- a/v3/internal/runtime/desktop/@wailsio/runtime/package.json +++ b/v3/internal/runtime/desktop/@wailsio/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@wailsio/runtime", - "version": "3.0.0-alpha.4", + "version": "3.0.0-alpha.6", "description": "Wails Runtime", "main": "index.js", "repository": { @@ -12,5 +12,6 @@ "bugs": { "url": "https://github.com/wailsapp/wails/issues" }, - "homepage": "https://wails.io" + "homepage": "https://wails.io", + "private": false } diff --git a/v3/internal/runtime/desktop/@wailsio/runtime/system.js b/v3/internal/runtime/desktop/@wailsio/runtime/system.js index 73fd5281b..54d2e2384 100644 --- a/v3/internal/runtime/desktop/@wailsio/runtime/system.js +++ b/v3/internal/runtime/desktop/@wailsio/runtime/system.js @@ -116,3 +116,7 @@ export function IsARM() { export function IsARM64() { return environmentCache.Arch === "arm64"; } + +export function IsDebug() { + return environmentCache.Debug === true; +} \ No newline at end of file diff --git a/v3/internal/runtime/desktop/@wailsio/runtime/wml.js b/v3/internal/runtime/desktop/@wailsio/runtime/wml.js index c8c2e715d..670362daa 100644 --- a/v3/internal/runtime/desktop/@wailsio/runtime/wml.js +++ b/v3/internal/runtime/desktop/@wailsio/runtime/wml.js @@ -2,6 +2,7 @@ import {Emit, WailsEvent} from "./events"; import {Question} from "./dialogs"; import {WindowMethods, Get} from "./window"; +import {OpenURL} from "./browser"; /** * Sends an event with the given name and optional data. @@ -119,12 +120,12 @@ function addWMLOpenBrowserListener() { if (confirm) { Question({Title: "Confirm", Message:confirm, Buttons:[{Label:"Yes"},{Label:"No", IsDefault:true}]}).then(function (result) { if (result !== "No") { - void wails.Browser.OpenURL(url); + void OpenURL(url); } }); return; } - void wails.Browser.OpenURL(url); + void OpenURL(url); }; // Remove existing listeners