cordova - 如何处理离子中的应用程序退出?
问题描述
我一直在使用平台的暂停和恢复事件,如下面的代码,但我想在用户关闭应用程序而不是在后台使用应用程序时处理退出事件。
this.platform.ready().then(() => {
if (this.platform.is('cordova')){
this.platform.pause.subscribe(() => {
this.stopTimer();
});
}
});
有没有办法获得任何帮助。
解决方案
对于浏览器,您可以尝试这样的操作,直接访问窗口事件:
window.addEventListener('beforeunload', () => {
this.OptionsSave();
});
推荐阅读
- android - Dagger-2 没有在 KOTLIN 中生成静态组件类 - Android
- html - 使用QDomDocument解析html数据时如何保留“?
- python - 新手卡在 Python Quandl ValueError 上
- angular - 如何在 Angular 6 的子组件中使用服务内部的方法
- c# - 阻塞与非阻塞异步代码
- asp.net - TryCast(row.FindControl) 无法更新记录
- python - 导航菜单烧瓶
- excel - Excel VBA Print 添加新行
- python - 如何在 https 服务器上运行烧瓶 python 应用程序?
- c# - 工作流控制“类型”如何与 .CS 类文件相关?