5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 03:21:32 +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;
width: 20em;
position: relative;
height: 17em;
height: 14em;
border-radius: 1em;
margin: 5% auto 0;
background-color: white;

View File

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