Typically, when I’m editing something in a native app — such as an email — and I navigate away from the app to another app, or to the main screen, I get a notification that says “Saved”.
I need to do something similar in my Elm app.
Html.Events.onFocus
and Html.Events.onBlur
(and the elm-ui equivalents) don’t seem to do what I want — in fact they don’t seem to do anything — and Html.Events.on “focusin”
and Html.Events.on “focusout”
seem to have strange behaviour — see How to detect focus and blur
Browser.Events.onVisibilityChange
detects when the app window is gone from sight, but what about when someone simply clicks on another window when the app is on a desktop? How can I detect that kind of ‘navigating away’?