No `BackHandler` for compose web?
# compose
e
No
BackHandler
for compose web?
e
Depending on what you're trying to do, it's not as simple as it would seem. See my implementation here and here. It does more than
BackHandler
but it supports
BackHandler
and keeps the browser and CMP navigation in sync across all platforms.
e
Thanks, I'm mobile dev doing small web app, so no idea what is navigation in browser is. After researching I have an idea how things could be implemented, done, etc. Thank you for the examples!
a
@Eugene Garagulya as Eliezer said it really depends what you are trying to implement. Are you trying to detect when the user is trying to navigate away or when a specific key was pressed?
in my case, I needed to know when a specific key was pressed (Esc), the same way as Back handler on android tells you when back was pressed. here is the multiplatform implementation on all platforms: https://github.com/search?q=repo%3Acomposablehorizons%2Fcomposables-core+fun+KeyDownHandler&type=code
e
Thanks!
👍 1