mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
Update runtime.System to make all methods
This commit is contained in:
parent
145656bc43
commit
0113fbff4f
7 changed files with 29 additions and 6 deletions
|
|
@ -18,7 +18,7 @@ const common = require('./common');
|
|||
|
||||
export const System = {
|
||||
...common,
|
||||
Platform: "darwin",
|
||||
Platform: () => "darwin",
|
||||
}
|
||||
|
||||
export function SendMessage(message) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
4
v2/internal/runtime/js/runtime/runtime.d.ts
vendored
4
v2/internal/runtime/js/runtime/runtime.d.ts
vendored
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
||||
|
|
|
|||
8
v2/internal/runtime/system_desktop.go
Normal file
8
v2/internal/runtime/system_desktop.go
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// +build desktop,!server
|
||||
|
||||
package runtime
|
||||
|
||||
// AppType returns the application type, EG: desktop
|
||||
func (r *system) AppType() string {
|
||||
return "desktop"
|
||||
}
|
||||
8
v2/internal/runtime/system_server.go
Normal file
8
v2/internal/runtime/system_server.go
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// +build server
|
||||
|
||||
package runtime
|
||||
|
||||
// AppType returns the application type, EG: desktop
|
||||
func (r *system) AppType() string {
|
||||
return "server"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue