mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
app,io/key,io/system: [API] replace system.CommandEvent with key.Event
It's much simpler to map the Android back button to a key.Event and let the usual key filtering determine whether to block its default behaviour. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+1
-4
@@ -172,12 +172,9 @@ func (w *window) addEventListeners() {
|
||||
return nil
|
||||
})
|
||||
w.addEventListener(w.window, "popstate", func(this js.Value, args []js.Value) interface{} {
|
||||
ev := &system.CommandEvent{Type: system.CommandBack}
|
||||
w.w.Event(ev)
|
||||
if ev.Cancel {
|
||||
if w.w.Event(key.Event{Name: key.NameBack}) {
|
||||
return w.browserHistory.Call("forward")
|
||||
}
|
||||
|
||||
return w.browserHistory.Call("back")
|
||||
})
|
||||
w.addEventListener(w.document, "visibilitychange", func(this js.Value, args []js.Value) interface{} {
|
||||
|
||||
Reference in New Issue
Block a user