2018-03-26 09:29:35 +08:00
|
|
|
import messagingService from "./messaging.js";
|
2018-03-26 10:37:02 +08:00
|
|
|
import utils from "./utils.js";
|
2018-03-26 09:29:35 +08:00
|
|
|
|
|
|
|
function showMessage(message) {
|
2018-03-26 10:37:02 +08:00
|
|
|
console.log(utils.now(), "message: ", message);
|
2018-03-26 09:29:35 +08:00
|
|
|
|
|
|
|
$.notify({
|
|
|
|
// options
|
|
|
|
message: message
|
|
|
|
}, {
|
2018-04-02 05:41:28 +08:00
|
|
|
// options
|
2018-03-26 09:29:35 +08:00
|
|
|
type: 'success',
|
|
|
|
delay: 3000
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-08-17 17:31:42 +08:00
|
|
|
function showAndLogError(message, delay = 10000) {
|
|
|
|
showError(message, delay);
|
|
|
|
|
|
|
|
messagingService.logError(message);
|
|
|
|
}
|
|
|
|
|
2018-03-26 09:29:35 +08:00
|
|
|
function showError(message, delay = 10000) {
|
2018-03-26 10:37:02 +08:00
|
|
|
console.log(utils.now(), "error: ", message);
|
2018-03-26 09:29:35 +08:00
|
|
|
|
|
|
|
$.notify({
|
|
|
|
// options
|
|
|
|
message: message
|
|
|
|
}, {
|
2018-04-02 05:41:28 +08:00
|
|
|
// options
|
2018-03-26 09:29:35 +08:00
|
|
|
type: 'danger',
|
|
|
|
delay: delay
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function throwError(message) {
|
|
|
|
messagingService.logError(message);
|
|
|
|
|
|
|
|
throw new Error(message);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
showMessage,
|
|
|
|
showError,
|
2018-08-17 17:31:42 +08:00
|
|
|
showAndLogError,
|
2018-03-26 09:29:35 +08:00
|
|
|
throwError
|
|
|
|
}
|