mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 05:08:54 -07:00
Merge v1
This commit is contained in:
@@ -74,6 +74,10 @@ func (h *Bridge) evalJS(js string, mtype messageType) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// EnableConsole not needed for bridge!
|
||||
func (h *Bridge) EnableConsole() {
|
||||
}
|
||||
|
||||
func (h *Bridge) injectCSS(css string) {
|
||||
// Minify css to overcome issues in the browser with carriage returns
|
||||
minified, err := htmlmin.Minify([]byte(css), &htmlmin.Options{
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -19,12 +19,13 @@ import (
|
||||
// WebView defines the main webview application window
|
||||
// Default values in []
|
||||
type WebView struct {
|
||||
window wv.WebView // The webview object
|
||||
ipc interfaces.IPCManager
|
||||
log *logger.CustomLogger
|
||||
config interfaces.AppConfig
|
||||
eventManager interfaces.EventManager
|
||||
bindingCache []string
|
||||
window wv.WebView // The webview object
|
||||
ipc interfaces.IPCManager
|
||||
log *logger.CustomLogger
|
||||
config interfaces.AppConfig
|
||||
eventManager interfaces.EventManager
|
||||
bindingCache []string
|
||||
enableConsole bool
|
||||
}
|
||||
|
||||
// NewWebView returns a new WebView struct
|
||||
@@ -103,6 +104,11 @@ func (w *WebView) evalJS(js string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// EnableConsole enables the console!
|
||||
func (w *WebView) EnableConsole() {
|
||||
w.enableConsole = true
|
||||
}
|
||||
|
||||
// Escape the Javascripts!
|
||||
func escapeJS(js string) (string, error) {
|
||||
result := strings.Replace(js, "\\", "\\\\", -1)
|
||||
@@ -172,6 +178,13 @@ func (w *WebView) Run() error {
|
||||
|
||||
w.log.Info("Running...")
|
||||
|
||||
// Inject firebug in debug mode on Windows
|
||||
if w.enableConsole {
|
||||
w.log.Debug("Enabling Wails console")
|
||||
console := mewn.String("../../runtime/assets/console.js")
|
||||
w.evalJS(console)
|
||||
}
|
||||
|
||||
// Runtime assets
|
||||
wailsRuntime := mewn.String("../../runtime/assets/wails.js")
|
||||
w.evalJS(wailsRuntime)
|
||||
|
||||
Reference in New Issue
Block a user