mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
Disable runtime option in assetserver
Runtime off by default in v3
This commit is contained in:
parent
c96cc3ff27
commit
204f33805f
5 changed files with 18 additions and 6 deletions
|
|
@ -43,6 +43,7 @@ type AssetServer struct {
|
|||
runtimeHandler RuntimeHandler
|
||||
|
||||
assetServerWebView
|
||||
disableRuntime bool
|
||||
}
|
||||
|
||||
func NewAssetServerMainPage(bindingsJSON string, options *options.App, servingFromDisk bool, logger Logger, runtime RuntimeAssets) (*AssetServer, error) {
|
||||
|
|
@ -166,8 +167,10 @@ func (d *AssetServer) processIndexHTML(indexHTML []byte) ([]byte, error) {
|
|||
}
|
||||
}
|
||||
|
||||
if err := insertScriptInHead(htmlNode, runtimeJSPath); err != nil {
|
||||
return nil, err
|
||||
if !d.disableRuntime {
|
||||
if err := insertScriptInHead(htmlNode, runtimeJSPath); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if err := insertScriptInHead(htmlNode, ipcJSPath); err != nil {
|
||||
|
|
@ -206,3 +209,7 @@ func (d *AssetServer) logError(message string, args ...interface{}) {
|
|||
d.logger.Error("[AssetServer] "+message, args...)
|
||||
}
|
||||
}
|
||||
|
||||
func (d *AssetServer) DisableRuntime() {
|
||||
d.disableRuntime = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ Informal and incomplete list of things needed in v3.
|
|||
- [x] Screens
|
||||
- [x] Clipboard
|
||||
- [x] Application
|
||||
- [ ] Create `.d.ts` file
|
||||
- [ ] Move to typescript module
|
||||
- [ ] Move WML to plugin
|
||||
|
||||
## Templates
|
||||
|
||||
|
|
|
|||
|
|
@ -24,9 +24,8 @@ function addWMLEventListeners() {
|
|||
return;
|
||||
}
|
||||
sendEvent(eventType);
|
||||
}
|
||||
};
|
||||
// Remove existing listeners
|
||||
|
||||
element.removeEventListener(trigger, callback);
|
||||
|
||||
// Add new listener
|
||||
|
|
@ -59,7 +58,7 @@ function addWMLWindowListeners() {
|
|||
return;
|
||||
}
|
||||
callWindowMethod(windowMethod);
|
||||
}
|
||||
};
|
||||
|
||||
// Remove existing listeners
|
||||
element.removeEventListener(trigger, callback);
|
||||
|
|
|
|||
|
|
@ -14,4 +14,6 @@ type Options struct {
|
|||
Silent bool
|
||||
CustomLoggers []logger.Output
|
||||
}
|
||||
// InjectRuntime will inject the JS runtime into all created webview windows.
|
||||
InjectRuntime bool
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,6 +121,9 @@ func NewWindow(options *WebviewWindowOptions) *WebviewWindow {
|
|||
|
||||
result.messageProcessor = NewMessageProcessor(result)
|
||||
srv.UseRuntimeHandler(result.messageProcessor)
|
||||
if !globalApplication.options.InjectRuntime {
|
||||
srv.DisableRuntime()
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue