这在 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;
}
};
在 Firefox 25.0 中,它会在评估来自消息框的响应之前抛出一个 ReferenceError 并且它正在取消导航而不调用该函数confirmDelete
。
问题是什么?