[purego] assethandler updates

This commit is contained in:
Travis McLane 2023-04-27 14:43:26 -05:00
commit ac5d0e54f0
3 changed files with 33 additions and 3 deletions

View file

@ -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
}

View file

@ -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) {

View file

@ -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]