10-20-2017 07:18
10-20-2017 07:18
I know we have the opportunity to save data before quitting app:
import { me } from "appbit";
me.onunload = () => {}
but it is a one way call with no return.
I had a long term test of my app yesterday and end up with an accidential quit of left button pressing during my sleep (I guess). It is a lap chronograph app with 100 laps data bank and 100 hours total counting time, it should not be quit without a double confirmation from user.
I am thinking of a system event which can prevent this.
Answered! Go to the Best Answer.
10-20-2017 07:40
10-20-2017 07:40
You might be able to listen to events for the BACK button, and stop it exiting the first attempt, but use it wisely. You should always provide users with a way to exit.
Something like:
import document from "document"; document.onkeypress = function(evt) { console.log("Key pressed: " + evt.key);
if (evt.key === "back") {
evt.preventDefault();
}}
10-20-2017 07:40
10-20-2017 07:40
You might be able to listen to events for the BACK button, and stop it exiting the first attempt, but use it wisely. You should always provide users with a way to exit.
Something like:
import document from "document"; document.onkeypress = function(evt) { console.log("Key pressed: " + evt.key);
if (evt.key === "back") {
evt.preventDefault();
}}
10-20-2017 07:51
10-20-2017 07:51
Thank you for your prompt reply!
Yes, I do test that before without that key line of
evt.preventDefault();
and leading to a mass,
🙂