|
双击退出安卓应用程序的方法utils.js中显示如下:但有些不太明白
attachDoubleClickExitApp:function(conditionFn){
var exitDtd = $.Deferred();
if(this.attached === true){
exitDtd.reject();
}else{
this.attached = true;
document.addEventListener("deviceready", function() {
var exitAppTicker = 0;
var listener = function(){
if(conditionFn()){ //conditionFn符合双击返回退出的回调,返回true/false
if(exitAppTicker === 0){
exitAppTicker++;
var msg = $('<span style="display: none;border-radius: 50px;padding: 7px;left: 50%;margin-left: -80px;background-color: #383838;color: #F0F0F0;z-index:9999;position:fixed;bottom:25px;">再按一次退出应用</span>').appendTo('body');
msg.fadeIn(400).delay(2000).fadeOut(400,function(){
exitAppTicker = 0;
msg.remove();
});
// window.location.href = "./main.w#!Activecontent";
// justep.Shell.showPage("main");
// justep.Shell.showMainPage();
}else if(exitAppTicker == 1){
exitDtd.resolve();
navigator.app.exitApp();
}
}else{
if($('html').hasClass("x-focus-in")){
$('html').removeClass("x-focus-in");
}else{
history.back();
}
}
};
document.addEventListener('backbutton', listener, false);
$(window).on('beforeunload', function(){
document.removeEventListener('backbutton', listener, false);
});
}, false);
}
其中 if($('html').hasClass("x-focus-in")){
$('html').removeClass("x-focus-in");什么意思,x-focus-in又指代的什么??请大神指教 |
|