Promisify gui.notify. Will not run it synchronously, but is nice to have.

This commit is contained in:
mmcwilliams 2019-05-28 17:47:39 -04:00
parent f015a6f2c5
commit 8ddc6e5a20
1 changed files with 16 additions and 9 deletions

View File

@ -37,6 +37,7 @@ gui.counterUpdate = function (which, raw) {
}; };
gui.notify = function (title, message) { gui.notify = function (title, message) {
'use strict'; 'use strict';
return new Promise((resolve, reject) => {
notifier.notify({ notifier.notify({
title: title, title: title,
message: message, message: message,
@ -45,7 +46,13 @@ gui.notify = function (title, message) {
wait: true // Wait with callback, until user action is taken against notification wait: true // Wait with callback, until user action is taken against notification
}, function (err, response) { }, function (err, response) {
// Response is response from notification // Response is response from notification
if (err) {
log.error(`Error with notification`, err);
return reject(err);
}
return resolve(true);
}); });
})
}; };
gui.updateCam = function (t) { gui.updateCam = function (t) {
'use strict'; 'use strict';