[英]MessageBox in canDeactivate method throws error in Firefox 25.0
This fails in Firefox 25.0 but works without problems in Chrome and IE 11: 这在Firefox 25.0中失败,但在Chrome和IE 11中可以正常工作:
var canDeactivate = function () {
if (hasChanges()) {
console.log(customer().CustomerID() < 0);
var msg = customer().CustomerID() < 0 ?
'Are you sure you want to discard the customer - "' + customer().CustomerName() + '" ?' :
'Are you sure you want to discard the changes\n for the the customer - "' + customer().CustomerName() + '" ?';
var title = 'Confirm navigation';
return app.showMessage(msg, title, ['Yes', 'No'])
.then(confirmDelete);
function confirmDelete(selectedOption) {
if (selectedOption === 'Yes') {
return true;
}
else {
return false;
}
}
}
else {
return true;
}
};
In Firefox 25.0 it throws a ReferenceError before it evaluates the response from the message box and it is canceling the navigation without calling the function confirmDelete
. 在Firefox 25.0中,它在评估消息框的响应之前会抛出ReferenceError,并且它在取消导航的过程中未调用函数
confirmDelete
。
What is the problem? 问题是什么?
在return语句解决此问题之前,声明function confirmDelete() {...}
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.