mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 05:11:29 +08:00

* Tidy up runtime JS * Initial implementation of runtime over http * Update runtime deps. Fix test task. * Support Clipboard. Message Processor refactor. * Add `Window.Screen()` Clipboard `GetText` -> `Text` * Support most dialogs Better JS->Go object mapping Implement Go->JS callback mechanism Rename `window.runtime` -> `window.wails` to better reflect the Go API * Support SaveFile dialog * Remove go.work * Tidy up * Event->CustomEvent to prevent potential clash with native JS Event object Support Eventing * Support application calls * Support logging * Support named windows Remove debug info * Update v3 changes
29 lines
606 B
Go
29 lines
606 B
Go
package application
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
func (m *MessageProcessor) processEventsMethod(method string, rw http.ResponseWriter, _ *http.Request, window *WebviewWindow, params QueryParams) {
|
|
|
|
switch method {
|
|
case "Emit":
|
|
var event CustomEvent
|
|
err := params.ToStruct(&event)
|
|
if err != nil {
|
|
m.httpError(rw, "Error parsing event: %s", err)
|
|
return
|
|
}
|
|
if event.Name == "" {
|
|
m.httpError(rw, "Event name must be specified")
|
|
return
|
|
}
|
|
event.Sender = window.Name()
|
|
globalApplication.Events.Emit(&event)
|
|
m.ok(rw)
|
|
default:
|
|
m.httpError(rw, "Unknown event method: %s", method)
|
|
}
|
|
|
|
}
|