From 145656bc431656b21d46b62cf6037646d8cea5a3 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Fri, 23 Oct 2020 10:42:00 +1100 Subject: [PATCH] Improved runtime.System --- v2/internal/runtime/js/core/main.js | 2 ++ v2/internal/runtime/js/runtime/runtime.d.ts | 2 ++ v2/internal/runtime/js/runtime/system.js | 2 ++ 3 files changed, 6 insertions(+) diff --git a/v2/internal/runtime/js/core/main.js b/v2/internal/runtime/js/core/main.js index fd7298db..51678606 100644 --- a/v2/internal/runtime/js/core/main.js +++ b/v2/internal/runtime/js/core/main.js @@ -51,6 +51,8 @@ export function Init() { IsDarkMode: Store.New('isdarkmode'), LogLevel: Store.New('loglevel'), }; + // Copy platform specific information into it + Object.assign(window.wails.System, Platform.System); // Do platform specific Init Platform.Init(); diff --git a/v2/internal/runtime/js/runtime/runtime.d.ts b/v2/internal/runtime/js/runtime/runtime.d.ts index f73d5220..de1ddb12 100644 --- a/v2/internal/runtime/js/runtime/runtime.d.ts +++ b/v2/internal/runtime/js/runtime/runtime.d.ts @@ -38,6 +38,8 @@ declare const wailsapp__runtime: { DarkModeEnabled(): Promise; OnThemeChange(callback: (darkModeEnabled: boolean) => void): void; LogLevel(): Store; + Platform: string; + AppType: string }; Store: { New(name: string, defaultValue?: any): Store; diff --git a/v2/internal/runtime/js/runtime/system.js b/v2/internal/runtime/js/runtime/system.js index 5a28ab30..bf3a5e2e 100644 --- a/v2/internal/runtime/js/runtime/system.js +++ b/v2/internal/runtime/js/runtime/system.js @@ -37,4 +37,6 @@ module.exports = { OnThemeChange: OnThemeChange, DarkModeEnabled: DarkModeEnabled, LogLevel: window.wails.System.LogLevel, + Platform: window.wails.System.Platform, + AppType: window.wails.System.AppType }; \ No newline at end of file