mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-06 17:19:51 +08:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
6613cff1d5
8
.github/ISSUE_TEMPLATE/bug_report.md
vendored
8
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -8,8 +8,12 @@ assignees: ''
|
|||||||
---
|
---
|
||||||
|
|
||||||
#####################################################
|
#####################################################
|
||||||
If you have a technical issue, please do not open a bug this way!
|
**If you have a technical issue, please do not open a bug this way!**
|
||||||
Please use the `wails issue` command!
|
Please use the `wails issue` command!
|
||||||
|
If you do not do this then the issue may be closed automatically.
|
||||||
|
|
||||||
|
NOTE: If your bug is related to Windows, make sure you read
|
||||||
|
the [Windows Developer Guide](https://wails.app/guides/windows/)
|
||||||
#####################################################
|
#####################################################
|
||||||
|
|
||||||
**Description**
|
**Description**
|
||||||
@ -33,3 +37,5 @@ Please provide your platform, GO version and variables, etc
|
|||||||
|
|
||||||
**Additional context**
|
**Additional context**
|
||||||
Add any other context about the problem here.
|
Add any other context about the problem here.
|
||||||
|
|
||||||
|
- [ ] This issue is for Windows and I have read the [Windows Developer Guide](https://wails.app/guides/windows/)
|
||||||
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
@ -38,3 +38,6 @@ Wails is what it is because of the time and effort given by these great people.
|
|||||||
* [Altynbek](https://github.com/gelleson)
|
* [Altynbek](https://github.com/gelleson)
|
||||||
* [Kyle](https://github.com/kmuchmore)
|
* [Kyle](https://github.com/kmuchmore)
|
||||||
* [Balakrishna Prasad Ganne](https://github.com/aayush420)
|
* [Balakrishna Prasad Ganne](https://github.com/aayush420)
|
||||||
|
* [Charaf Rezrazi](https://github.com/Rezrazi)
|
||||||
|
* [misitebao](https://github.com/misitebao)
|
||||||
|
* [Elie Grenon](https://github.com/DrunkenPoney)
|
6
app.go
6
app.go
@ -2,7 +2,6 @@ package wails
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/syossan27/tebata"
|
"github.com/syossan27/tebata"
|
||||||
@ -117,11 +116,6 @@ func (a *App) start() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable console for Windows debug builds
|
|
||||||
if runtime.GOOS == "windows" && BuildMode == cmd.BuildModeDebug {
|
|
||||||
a.renderer.EnableConsole()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start signal handler
|
// Start signal handler
|
||||||
t := tebata.New(os.Interrupt, os.Kill, syscall.SIGTERM, syscall.SIGINT, syscall.SIGKILL)
|
t := tebata.New(os.Interrupt, os.Kill, syscall.SIGTERM, syscall.SIGINT, syscall.SIGKILL)
|
||||||
t.Reserve(func() {
|
t.Reserve(func() {
|
||||||
|
@ -574,6 +574,10 @@ func ldFlags(po *ProjectOptions, buildMode string) string {
|
|||||||
ldflags += "-H windowsgui "
|
ldflags += "-H windowsgui "
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if po.UseFirebug {
|
||||||
|
ldflags += "-X github.com/wailsapp/wails/lib/renderer.UseFirebug=true "
|
||||||
|
}
|
||||||
|
|
||||||
ldflags += "-X github.com/wailsapp/wails.BuildMode=" + buildMode
|
ldflags += "-X github.com/wailsapp/wails.BuildMode=" + buildMode
|
||||||
|
|
||||||
// Add additional ldflags passed in via the `ldflags` cli flag
|
// Add additional ldflags passed in via the `ldflags` cli flag
|
||||||
|
@ -65,6 +65,8 @@ const (
|
|||||||
Solus
|
Solus
|
||||||
// Ctlos Linux distribution
|
// Ctlos Linux distribution
|
||||||
Ctlos
|
Ctlos
|
||||||
|
// EndeavourOS linux distribution
|
||||||
|
EndeavourOS
|
||||||
)
|
)
|
||||||
|
|
||||||
// DistroInfo contains all the information relating to a linux distribution
|
// DistroInfo contains all the information relating to a linux distribution
|
||||||
@ -171,6 +173,8 @@ func parseOsRelease(osRelease string) *DistroInfo {
|
|||||||
result.Distribution = PopOS
|
result.Distribution = PopOS
|
||||||
case "solus":
|
case "solus":
|
||||||
result.Distribution = Solus
|
result.Distribution = Solus
|
||||||
|
case "endeavouros":
|
||||||
|
result.Distribution = EndeavourOS
|
||||||
default:
|
default:
|
||||||
result.Distribution = Unknown
|
result.Distribution = Unknown
|
||||||
}
|
}
|
||||||
|
@ -203,6 +203,15 @@ distributions:
|
|||||||
gccversioncommand: *gccdumpversion
|
gccversioncommand: *gccdumpversion
|
||||||
programs: *archdefaultprograms
|
programs: *archdefaultprograms
|
||||||
libraries: *archdefaultlibraries
|
libraries: *archdefaultlibraries
|
||||||
|
endeavouros:
|
||||||
|
id: endeavouros
|
||||||
|
releases:
|
||||||
|
default:
|
||||||
|
version: default
|
||||||
|
name: EndeavourOS
|
||||||
|
gccversioncommand: *gccdumpversion
|
||||||
|
programs: *archdefaultprograms
|
||||||
|
libraries: *archdefaultlibraries
|
||||||
manjaro:
|
manjaro:
|
||||||
id: manjaro
|
id: manjaro
|
||||||
releases:
|
releases:
|
||||||
|
@ -165,6 +165,7 @@ type ProjectOptions struct {
|
|||||||
Architecture string
|
Architecture string
|
||||||
LdFlags string
|
LdFlags string
|
||||||
GoPath string
|
GoPath string
|
||||||
|
UseFirebug bool
|
||||||
|
|
||||||
// Supported platforms
|
// Supported platforms
|
||||||
Platforms []string `json:"platforms,omitempty"`
|
Platforms []string `json:"platforms,omitempty"`
|
||||||
|
@ -276,7 +276,7 @@ func CheckDependencies(logger *Logger) (bool, error) {
|
|||||||
switch distroInfo.Distribution {
|
switch distroInfo.Distribution {
|
||||||
case Ubuntu, Debian, Zorin, Parrot, Linuxmint, Elementary, Kali, Neon, Deepin, Raspbian, PopOS:
|
case Ubuntu, Debian, Zorin, Parrot, Linuxmint, Elementary, Kali, Neon, Deepin, Raspbian, PopOS:
|
||||||
libraryChecker = DpkgInstalled
|
libraryChecker = DpkgInstalled
|
||||||
case Arch, ArcoLinux, ArchLabs, Ctlos, Manjaro, ManjaroARM:
|
case Arch, ArcoLinux, ArchLabs, Ctlos, Manjaro, ManjaroARM, EndeavourOS:
|
||||||
libraryChecker = PacmanInstalled
|
libraryChecker = PacmanInstalled
|
||||||
case CentOS, Fedora, Tumbleweed, Leap:
|
case CentOS, Fedora, Tumbleweed, Leap:
|
||||||
libraryChecker = RpmInstalled
|
libraryChecker = RpmInstalled
|
||||||
|
@ -19,16 +19,16 @@
|
|||||||
"@types/mocha": "^8.0.3",
|
"@types/mocha": "^8.0.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.3.0",
|
"@typescript-eslint/eslint-plugin": "^4.3.0",
|
||||||
"@typescript-eslint/parser": "^4.3.0",
|
"@typescript-eslint/parser": "^4.3.0",
|
||||||
"@vue/cli-plugin-eslint": "~4.5.6",
|
"@vue/cli-plugin-eslint": "~4.5.9",
|
||||||
"@vue/cli-plugin-router": "~4.5.6",
|
"@vue/cli-plugin-router": "~4.5.9",
|
||||||
"@vue/cli-plugin-typescript": "~4.5.6",
|
"@vue/cli-plugin-typescript": "~4.5.9",
|
||||||
"@vue/cli-plugin-unit-mocha": "~4.5.6",
|
"@vue/cli-plugin-unit-mocha": "~4.5.9",
|
||||||
"@vue/cli-service": "~4.5.6",
|
"@vue/cli-service": "~4.5.9",
|
||||||
"@vue/compiler-sfc": "^3.0.0",
|
"@vue/compiler-sfc": "^3.0.0",
|
||||||
"@vue/eslint-config-typescript": "^5.1.0",
|
"@vue/eslint-config-typescript": "^7.0.0",
|
||||||
"@vue/test-utils": "^2.0.0-0",
|
"@vue/test-utils": "^2.0.0-0",
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
"eslint": "^7.10.0",
|
"eslint": "<7.0.0",
|
||||||
"eslint-plugin-vue": "^7.0.0",
|
"eslint-plugin-vue": "^7.0.0",
|
||||||
"node-sass": "^4.14.1",
|
"node-sass": "^4.14.1",
|
||||||
"sass-loader": "^10.0.2",
|
"sass-loader": "^10.0.2",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
// Version - Wails version
|
// Version - Wails version
|
||||||
const Version = "v1.8.1-pre5"
|
const Version = "v1.11.0-pre2"
|
||||||
|
@ -26,6 +26,7 @@ func init() {
|
|||||||
var packageApp = false
|
var packageApp = false
|
||||||
var forceRebuild = false
|
var forceRebuild = false
|
||||||
var debugMode = false
|
var debugMode = false
|
||||||
|
var usefirebug = false
|
||||||
var gopath = ""
|
var gopath = ""
|
||||||
var typescriptFilename = ""
|
var typescriptFilename = ""
|
||||||
var verbose = false
|
var verbose = false
|
||||||
@ -42,6 +43,7 @@ func init() {
|
|||||||
BoolFlag("p", "Package application on successful build", &packageApp).
|
BoolFlag("p", "Package application on successful build", &packageApp).
|
||||||
BoolFlag("f", "Force rebuild of application components", &forceRebuild).
|
BoolFlag("f", "Force rebuild of application components", &forceRebuild).
|
||||||
BoolFlag("d", "Build in Debug mode", &debugMode).
|
BoolFlag("d", "Build in Debug mode", &debugMode).
|
||||||
|
BoolFlag("firebug", "Enable firebug console for debug builds", &usefirebug).
|
||||||
BoolFlag("verbose", "Verbose output", &verbose).
|
BoolFlag("verbose", "Verbose output", &verbose).
|
||||||
StringFlag("t", "Generate Typescript definitions to given file (at runtime)", &typescriptFilename).
|
StringFlag("t", "Generate Typescript definitions to given file (at runtime)", &typescriptFilename).
|
||||||
StringFlag("ldflags", "Extra options for -ldflags", &ldflags).
|
StringFlag("ldflags", "Extra options for -ldflags", &ldflags).
|
||||||
@ -71,6 +73,7 @@ func init() {
|
|||||||
// Project options
|
// Project options
|
||||||
projectOptions := &cmd.ProjectOptions{}
|
projectOptions := &cmd.ProjectOptions{}
|
||||||
projectOptions.Verbose = verbose
|
projectOptions.Verbose = verbose
|
||||||
|
projectOptions.UseFirebug = usefirebug
|
||||||
|
|
||||||
// Check we are in project directory
|
// Check we are in project directory
|
||||||
// Check project.json loads correctly
|
// Check project.json loads correctly
|
||||||
@ -80,6 +83,9 @@ func init() {
|
|||||||
return fmt.Errorf("Unable to find 'project.json'. Please check you are in a Wails project directory")
|
return fmt.Errorf("Unable to find 'project.json'. Please check you are in a Wails project directory")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set firebug flag
|
||||||
|
projectOptions.UseFirebug = usefirebug
|
||||||
|
|
||||||
// Check that this platform is supported
|
// Check that this platform is supported
|
||||||
if !projectOptions.PlatformSupported() {
|
if !projectOptions.PlatformSupported() {
|
||||||
logger.Yellow("WARNING: This project is unsupported on %s - it probably won't work!\n Valid platforms: %s\n", runtime.GOOS, strings.Join(projectOptions.Platforms, ", "))
|
logger.Yellow("WARNING: This project is unsupported on %s - it probably won't work!\n Valid platforms: %s\n", runtime.GOOS, strings.Join(projectOptions.Platforms, ", "))
|
||||||
|
56
config.go
56
config.go
@ -1,20 +1,37 @@
|
|||||||
package wails
|
package wails
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/leaanthony/mewn"
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/runtime"
|
"github.com/wailsapp/wails/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AppConfig is the configuration structure used when creating a Wails App object
|
// AppConfig is the configuration structure used when creating a Wails App object
|
||||||
type AppConfig struct {
|
type AppConfig struct {
|
||||||
|
// The width and height of your application in pixels
|
||||||
Width, Height int
|
Width, Height int
|
||||||
|
|
||||||
|
// The title to put in the title bar
|
||||||
Title string
|
Title string
|
||||||
defaultHTML string
|
|
||||||
|
// The HTML your app should use. If you leave it blank, a default will be used:
|
||||||
|
// <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="IE=edge" content="IE=edge"></head><body><div id="app"></div><script type="text/javascript"></script></body></html>
|
||||||
HTML string
|
HTML string
|
||||||
|
|
||||||
|
// The Javascript your app should use. Normally this should be generated by a bundler.
|
||||||
JS string
|
JS string
|
||||||
|
|
||||||
|
// The CSS your app should use. Normally this should be generated by a bundler.
|
||||||
CSS string
|
CSS string
|
||||||
|
|
||||||
|
// The colour of your window. Can take "#fff", "rgb(255,255,255)", "rgba(255,255,255,1)" formats
|
||||||
Colour string
|
Colour string
|
||||||
|
|
||||||
|
// Indicates whether your app should be resizable
|
||||||
Resizable bool
|
Resizable bool
|
||||||
|
|
||||||
|
// Indicated if the devtools should be disabled
|
||||||
DisableInspector bool
|
DisableInspector bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,9 +50,14 @@ func (a *AppConfig) GetTitle() string {
|
|||||||
return a.Title
|
return a.Title
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDefaultHTML returns the default HTML
|
// GetHTML returns the default HTML
|
||||||
func (a *AppConfig) GetDefaultHTML() string {
|
func (a *AppConfig) GetHTML() string {
|
||||||
return a.defaultHTML
|
if len(a.HTML) > 0 {
|
||||||
|
a.HTML = url.QueryEscape(a.HTML)
|
||||||
|
a.HTML = "data:text/html," + strings.ReplaceAll(a.HTML, "+", "%20")
|
||||||
|
a.HTML = strings.ReplaceAll(a.HTML, "%3D", "=")
|
||||||
|
}
|
||||||
|
return a.HTML
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetResizable returns true if the window should be resizable
|
// GetResizable returns true if the window should be resizable
|
||||||
@ -75,10 +97,18 @@ func (a *AppConfig) merge(in *AppConfig) error {
|
|||||||
a.Colour = in.Colour
|
a.Colour = in.Colour
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if in.HTML != "" {
|
||||||
|
a.HTML = in.HTML
|
||||||
|
}
|
||||||
|
|
||||||
if in.JS != "" {
|
if in.JS != "" {
|
||||||
a.JS = in.JS
|
a.JS = in.JS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if in.HTML != "" {
|
||||||
|
a.HTML = in.HTML
|
||||||
|
}
|
||||||
|
|
||||||
if in.Width != 0 {
|
if in.Width != 0 {
|
||||||
a.Width = in.Width
|
a.Width = in.Width
|
||||||
}
|
}
|
||||||
@ -99,7 +129,7 @@ func newConfig(userConfig *AppConfig) (*AppConfig, error) {
|
|||||||
Resizable: true,
|
Resizable: true,
|
||||||
Title: "My Wails App",
|
Title: "My Wails App",
|
||||||
Colour: "#FFF", // White by default
|
Colour: "#FFF", // White by default
|
||||||
HTML: mewn.String("./runtime/assets/default.html"),
|
HTML: defaultHTML,
|
||||||
}
|
}
|
||||||
|
|
||||||
if userConfig != nil {
|
if userConfig != nil {
|
||||||
@ -111,3 +141,17 @@ func newConfig(userConfig *AppConfig) (*AppConfig, error) {
|
|||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var defaultHTML = `<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>`
|
||||||
|
@ -6,7 +6,7 @@ type AppConfig interface {
|
|||||||
GetHeight() int
|
GetHeight() int
|
||||||
GetTitle() string
|
GetTitle() string
|
||||||
GetResizable() bool
|
GetResizable() bool
|
||||||
GetDefaultHTML() string
|
GetHTML() string
|
||||||
GetDisableInspector() bool
|
GetDisableInspector() bool
|
||||||
GetColour() string
|
GetColour() string
|
||||||
GetCSS() string
|
GetCSS() string
|
||||||
|
@ -8,7 +8,6 @@ import (
|
|||||||
type Renderer interface {
|
type Renderer interface {
|
||||||
Initialise(AppConfig, IPCManager, EventManager) error
|
Initialise(AppConfig, IPCManager, EventManager) error
|
||||||
Run() error
|
Run() error
|
||||||
EnableConsole()
|
|
||||||
|
|
||||||
// Binding
|
// Binding
|
||||||
NewBinding(bindingName string) error
|
NewBinding(bindingName string) error
|
||||||
|
@ -56,10 +56,6 @@ func (h *Bridge) Initialise(appConfig interfaces.AppConfig, ipcManager interface
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnableConsole not needed for bridge!
|
|
||||||
func (h *Bridge) EnableConsole() {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *Bridge) wsBridgeHandler(w http.ResponseWriter, r *http.Request) {
|
func (h *Bridge) wsBridgeHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
conn, err := websocket.Upgrade(w, r, w.Header(), 1024, 1024)
|
conn, err := websocket.Upgrade(w, r, w.Header(), 1024, 1024)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
File diff suppressed because one or more lines are too long
@ -2,7 +2,6 @@ package renderer
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
|
||||||
|
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"github.com/leaanthony/mewn"
|
"github.com/leaanthony/mewn"
|
||||||
@ -50,7 +49,7 @@ func (s *session) Identifier() string {
|
|||||||
|
|
||||||
func (s *session) sendMessage(msg string) error {
|
func (s *session) sendMessage(msg string) error {
|
||||||
if !s.done {
|
if !s.done {
|
||||||
s.writeChan <- *(*[]byte)(unsafe.Pointer(&msg))
|
s.writeChan <- []byte(msg)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -18,6 +18,10 @@ import (
|
|||||||
|
|
||||||
// WebView defines the main webview application window
|
// WebView defines the main webview application window
|
||||||
// Default values in []
|
// Default values in []
|
||||||
|
|
||||||
|
// UseFirebug indicates whether to inject the firebug console
|
||||||
|
var UseFirebug = ""
|
||||||
|
|
||||||
type WebView struct {
|
type WebView struct {
|
||||||
window wv.WebView // The webview object
|
window wv.WebView // The webview object
|
||||||
ipc interfaces.IPCManager
|
ipc interfaces.IPCManager
|
||||||
@ -25,7 +29,6 @@ type WebView struct {
|
|||||||
config interfaces.AppConfig
|
config interfaces.AppConfig
|
||||||
eventManager interfaces.EventManager
|
eventManager interfaces.EventManager
|
||||||
bindingCache []string
|
bindingCache []string
|
||||||
enableConsole bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewWebView returns a new WebView struct
|
// NewWebView returns a new WebView struct
|
||||||
@ -55,7 +58,7 @@ func (w *WebView) Initialise(config interfaces.AppConfig, ipc interfaces.IPCMana
|
|||||||
Height: config.GetHeight(),
|
Height: config.GetHeight(),
|
||||||
Title: config.GetTitle(),
|
Title: config.GetTitle(),
|
||||||
Resizable: config.GetResizable(),
|
Resizable: config.GetResizable(),
|
||||||
URL: config.GetDefaultHTML(),
|
URL: config.GetHTML(),
|
||||||
Debug: !config.GetDisableInspector(),
|
Debug: !config.GetDisableInspector(),
|
||||||
ExternalInvokeCallback: func(_ wv.WebView, message string) {
|
ExternalInvokeCallback: func(_ wv.WebView, message string) {
|
||||||
w.ipc.Dispatch(message, w.callback)
|
w.ipc.Dispatch(message, w.callback)
|
||||||
@ -104,11 +107,6 @@ func (w *WebView) evalJS(js string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnableConsole enables the console!
|
|
||||||
func (w *WebView) EnableConsole() {
|
|
||||||
w.enableConsole = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Escape the Javascripts!
|
// Escape the Javascripts!
|
||||||
func escapeJS(js string) (string, error) {
|
func escapeJS(js string) (string, error) {
|
||||||
result := strings.Replace(js, "\\", "\\\\", -1)
|
result := strings.Replace(js, "\\", "\\\\", -1)
|
||||||
@ -179,10 +177,9 @@ func (w *WebView) Run() error {
|
|||||||
w.log.Info("Running...")
|
w.log.Info("Running...")
|
||||||
|
|
||||||
// Inject firebug in debug mode on Windows
|
// Inject firebug in debug mode on Windows
|
||||||
if w.enableConsole {
|
if UseFirebug != "" {
|
||||||
w.log.Debug("Enabling Wails console")
|
w.log.Debug("Injecting Firebug")
|
||||||
console := mewn.String("../../runtime/assets/console.js")
|
w.evalJS(`window.usefirebug=true;`)
|
||||||
w.evalJS(console)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Runtime assets
|
// Runtime assets
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div id="app"></div>
|
|
||||||
<script type="text/javascript">function AddScript(js, callbackID) {
|
|
||||||
var script = document.createElement('script');
|
|
||||||
script.text = js;
|
|
||||||
document.body.appendChild(script);
|
|
||||||
}</script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
File diff suppressed because one or more lines are too long
@ -13,7 +13,7 @@ import * as Browser from './browser';
|
|||||||
import { On, OnMultiple, Emit, Notify, Heartbeat, Acknowledge } from './events';
|
import { On, OnMultiple, Emit, Notify, Heartbeat, Acknowledge } from './events';
|
||||||
import { NewBinding } from './bindings';
|
import { NewBinding } from './bindings';
|
||||||
import { Callback } from './calls';
|
import { Callback } from './calls';
|
||||||
import { AddScript, InjectCSS } from './utils';
|
import { AddScript, InjectCSS, InjectFirebug } from './utils';
|
||||||
import { AddIPCListener } from './ipc';
|
import { AddIPCListener } from './ipc';
|
||||||
import * as Store from './store';
|
import * as Store from './store';
|
||||||
|
|
||||||
@ -60,6 +60,11 @@ window.onerror = function (msg, url, lineNo, columnNo, error) {
|
|||||||
window.wails.Log.Error('error: ' + error);
|
window.wails.Log.Error('error: ' + error);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Use firebug?
|
||||||
|
if( window.usefirebug ) {
|
||||||
|
InjectFirebug();
|
||||||
|
}
|
||||||
|
|
||||||
// Emit loaded event
|
// Emit loaded event
|
||||||
Emit('wails:loaded');
|
Emit('wails:loaded');
|
||||||
|
|
||||||
|
@ -20,6 +20,18 @@ export function AddScript(js, callbackID) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function InjectFirebug() {
|
||||||
|
// set the debug attribute on HTML
|
||||||
|
var html = document.getElementsByTagName('html')[0];
|
||||||
|
html.setAttribute('debug', 'true');
|
||||||
|
var firebugURL = 'https://wails.app/assets/js/firebug-lite.js#startOpened=true,disableWhenFirebugActive=false';
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.src = firebugURL;
|
||||||
|
script.type = 'application/javascript';
|
||||||
|
document.head.appendChild(script);
|
||||||
|
window.wails.Log.Info('Injected firebug');
|
||||||
|
}
|
||||||
|
|
||||||
// Adapted from webview - thanks zserge!
|
// Adapted from webview - thanks zserge!
|
||||||
export function InjectCSS(css) {
|
export function InjectCSS(css) {
|
||||||
var elem = document.createElement('style');
|
var elem = document.createElement('style');
|
||||||
|
6
runtime/js/package-lock.json
generated
6
runtime/js/package-lock.json
generated
@ -3959,9 +3959,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"ini": {
|
"ini": {
|
||||||
"version": "1.3.5",
|
"version": "1.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
|
||||||
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
|
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"interpret": {
|
"interpret": {
|
||||||
|
8
runtime/js/runtime/package-lock.json
generated
8
runtime/js/runtime/package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@wailsapp/runtime",
|
"name": "@wailsapp/runtime",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -130,9 +130,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"ini": {
|
"ini": {
|
||||||
"version": "1.3.5",
|
"version": "1.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
|
||||||
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
|
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"invert-kv": {
|
"invert-kv": {
|
||||||
|
Loading…
Reference in New Issue
Block a user