Update runtime.System to make all methods

This commit is contained in:
Lea Anthony 2020-10-23 11:19:38 +11:00
commit 0113fbff4f
No known key found for this signature in database
GPG key ID: 33DAF7BB90A58405
7 changed files with 29 additions and 6 deletions

View file

@ -18,7 +18,7 @@ const common = require('./common');
export const System = {
...common,
Platform: "darwin",
Platform: () => "darwin",
}
export function SendMessage(message) {

View file

@ -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) {

View file

@ -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",

View file

@ -38,8 +38,8 @@ declare const wailsapp__runtime: {
DarkModeEnabled(): Promise<boolean>;
OnThemeChange(callback: (darkModeEnabled: boolean) => void): void;
LogLevel(): Store;
Platform: string;
AppType: string
Platform(): string;
AppType(): string
};
Store: {
New(name: string, defaultValue?: any): Store;

View file

@ -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 {

View file

@ -0,0 +1,8 @@
// +build desktop,!server
package runtime
// AppType returns the application type, EG: desktop
func (r *system) AppType() string {
return "desktop"
}

View file

@ -0,0 +1,8 @@
// +build server
package runtime
// AppType returns the application type, EG: desktop
func (r *system) AppType() string {
return "server"
}