20148 月28
Cordova:连续按两次返回键退出程序
/** * Created by Wizzer on 14-8-28. */ var num = 0; var login = { initialize: function () { this.bindEvents(); }, bindEvents: function () { document.addEventListener('backbutton', this.eventBackButton, false); }, eventBackButton: function () { num++; if (num > 1) { navigator.app.exitApp(); } navigator.toast.show("再点击一次退出"); // 3秒后重新计数 var intervalID = window.setInterval(function() { num=0; window.clearInterval(intervalID); }, 3000); } };
浮动提示插件见:
/?p=3026
本文地址:https://wizzer.cn/archives/3023 , 转载请保留.