5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-04 06:59:18 +08:00

Merge pull request #19 from wailsapp/Update-execution-order-in-Headless-mode

fix for ipc binding
This commit is contained in:
Lea Anthony 2019-01-12 16:00:44 +11:00 committed by GitHub
commit 4c98ce7da1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 9 deletions

View File

@ -20,7 +20,7 @@
text-align: center; text-align: center;
width: 20em; width: 20em;
position: relative; position: relative;
height: 17em; height: 14em;
border-radius: 1em; border-radius: 1em;
margin: 5% auto 0; margin: 5% auto 0;
background-color: white; background-color: white;

View File

@ -39,6 +39,7 @@ func (h *Headless) Initialise(appConfig *AppConfig, ipcManager *ipcManager, even
h.ipcManager = ipcManager h.ipcManager = ipcManager
h.appConfig = appConfig h.appConfig = appConfig
h.eventManager = eventManager h.eventManager = eventManager
ipcManager.bindRenderer(h)
h.log = newCustomLogger("Headless") h.log = newCustomLogger("Headless")
return nil return nil
} }
@ -99,16 +100,12 @@ func (h *Headless) start(conn *websocket.Conn) {
// set external.invoke // set external.invoke
h.log.Infof("Connected to frontend.") h.log.Infof("Connected to frontend.")
// If we are given an HTML fragment, load jquery wailsRuntime := BoxString(&defaultAssets, "wails.js")
// for the html() function h.evalJS(wailsRuntime)
if h.appConfig.isHTMLFragment {
// Inject jquery // Inject jquery
jquery := BoxString(&defaultAssets, "jquery.3.3.1.min.js") jquery := BoxString(&defaultAssets, "jquery.3.3.1.min.js")
h.evalJS(jquery) h.evalJS(jquery)
}
wailsRuntime := BoxString(&defaultAssets, "wails.js")
h.evalJS(wailsRuntime)
// Inject the initial JS // Inject the initial JS
for _, js := range h.initialisationJS { for _, js := range h.initialisationJS {