diff --git a/v2/internal/runtime/js/desktop/darwin.js b/v2/internal/runtime/js/desktop/darwin.js index 7881e75b3..39da3ee92 100644 --- a/v2/internal/runtime/js/desktop/darwin.js +++ b/v2/internal/runtime/js/desktop/darwin.js @@ -18,7 +18,7 @@ const common = require('./common'); export const System = { ...common, - Platform: "darwin", + Platform: () => "darwin", } export function SendMessage(message) { diff --git a/v2/internal/runtime/js/desktop/linux.js b/v2/internal/runtime/js/desktop/linux.js index 95c0d15ef..aaefac440 100644 --- a/v2/internal/runtime/js/desktop/linux.js +++ b/v2/internal/runtime/js/desktop/linux.js @@ -14,8 +14,8 @@ The lightweight framework for web-like apps */ export const System = { - Platform: "linux", - AppType: "desktop" + ...common, + Platform: () => "linux", } export function SendMessage(message) { diff --git a/v2/internal/runtime/js/runtime/package.json b/v2/internal/runtime/js/runtime/package.json index 228e54d15..1493b23c0 100644 --- a/v2/internal/runtime/js/runtime/package.json +++ b/v2/internal/runtime/js/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@wails/runtime", - "version": "1.0.9", + "version": "1.0.11", "description": "Wails V2 Javascript runtime library", "main": "main.js", "types": "runtime.d.ts", diff --git a/v2/internal/runtime/js/runtime/runtime.d.ts b/v2/internal/runtime/js/runtime/runtime.d.ts index de1ddb12a..525558393 100644 --- a/v2/internal/runtime/js/runtime/runtime.d.ts +++ b/v2/internal/runtime/js/runtime/runtime.d.ts @@ -38,8 +38,8 @@ declare const wailsapp__runtime: { DarkModeEnabled(): Promise; OnThemeChange(callback: (darkModeEnabled: boolean) => void): void; LogLevel(): Store; - Platform: string; - AppType: string + Platform(): string; + AppType(): string }; Store: { New(name: string, defaultValue?: any): Store; diff --git a/v2/internal/runtime/system.go b/v2/internal/runtime/system.go index ca5099c69..c82af3124 100644 --- a/v2/internal/runtime/system.go +++ b/v2/internal/runtime/system.go @@ -2,6 +2,7 @@ package runtime import ( "fmt" + "runtime" "github.com/wailsapp/wails/v2/internal/crypto" "github.com/wailsapp/wails/v2/internal/servicebus" @@ -24,6 +25,12 @@ func newSystem(bus *servicebus.ServiceBus) System { } } +// Platform returns the platform name the application +// is running on +func (r *system) Platform() string { + return runtime.GOOS +} + // On pass through func (r *system) IsDarkMode() bool { diff --git a/v2/internal/runtime/system_desktop.go b/v2/internal/runtime/system_desktop.go new file mode 100644 index 000000000..e569a8555 --- /dev/null +++ b/v2/internal/runtime/system_desktop.go @@ -0,0 +1,8 @@ +// +build desktop,!server + +package runtime + +// AppType returns the application type, EG: desktop +func (r *system) AppType() string { + return "desktop" +} diff --git a/v2/internal/runtime/system_server.go b/v2/internal/runtime/system_server.go new file mode 100644 index 000000000..fb17eb08a --- /dev/null +++ b/v2/internal/runtime/system_server.go @@ -0,0 +1,8 @@ +// +build server + +package runtime + +// AppType returns the application type, EG: desktop +func (r *system) AppType() string { + return "server" +}