mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
[purego] assethandler updates
This commit is contained in:
@@ -84,3 +84,13 @@ func (r *request) Response() ResponseWriter {
|
||||
r.rw = &responseWriter{req: r.req}
|
||||
return r.rw
|
||||
}
|
||||
|
||||
func (r *request) Close() error {
|
||||
var err error
|
||||
if r.body != nil {
|
||||
err = r.body.Close()
|
||||
}
|
||||
r.Response().Finish()
|
||||
r.Release()
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -121,19 +121,18 @@ func (rw *responseWriter) WriteHeader(code int) {
|
||||
}
|
||||
}
|
||||
|
||||
func (rw *responseWriter) Finish() error {
|
||||
func (rw *responseWriter) Finish() {
|
||||
if !rw.wroteHeader {
|
||||
rw.WriteHeader(http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
if rw.finished {
|
||||
return nil
|
||||
return
|
||||
}
|
||||
rw.finished = true
|
||||
if rw.w != nil {
|
||||
rw.w.Close()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rw *responseWriter) finishWithError(code int, err error) {
|
||||
|
||||
@@ -390,6 +390,27 @@ func (a *App) Run() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// activate is called by the implementation to notify it is ready to run
|
||||
func (a *App) activate() {
|
||||
a.info("Starting window(s)")
|
||||
// run windows
|
||||
for _, window := range a.windows {
|
||||
go window.run()
|
||||
}
|
||||
|
||||
a.info("Starting systray(s)")
|
||||
// run system trays
|
||||
for _, systray := range a.systemTrays {
|
||||
go systray.Run()
|
||||
}
|
||||
|
||||
// set the application menu
|
||||
a.impl.setApplicationMenu(a.ApplicationMenu)
|
||||
|
||||
// set the application Icon
|
||||
a.impl.setIcon(a.options.Icon)
|
||||
}
|
||||
|
||||
func (a *App) handleApplicationEvent(event uint) {
|
||||
a.applicationEventListenersLock.RLock()
|
||||
listeners, ok := a.applicationEventListeners[event]
|
||||
|
||||
Reference in New Issue
Block a user