Add notifier

This commit is contained in:
Matt 2016-04-22 14:34:16 -04:00
parent b44fc327c6
commit 2697d9f721
1 changed files with 14 additions and 0 deletions

View File

@ -1,5 +1,6 @@
var remote = require('remote'), var remote = require('remote'),
dialog = require('electron').remote.dialog, dialog = require('electron').remote.dialog,
notifier = require('node-notifier'),
fs = require('fs'), fs = require('fs'),
uuid = require('node-uuid'), uuid = require('node-uuid'),
moment = require('moment'), moment = require('moment'),
@ -175,6 +176,7 @@ seq.run = function () {
} else { } else {
log.info('Sequence completed in ' + humanizeDuration(timeEnd), 'SEQUENCE', true); log.info('Sequence completed in ' + humanizeDuration(timeEnd), 'SEQUENCE', true);
} }
gui.notify('Sequence done!', (mcopy.state.sequence.arr.length * mcopy.loop) + ' actions completed in ' + humanizeDuration(timeEnd));
//clear gui //clear gui
$('.row input').removeClass('h'); $('.row input').removeClass('h');
$('#numbers div').removeClass('h'); $('#numbers div').removeClass('h');
@ -900,6 +902,18 @@ gui.counterFormat = function (t, normal, prevent) {
gui.shootGoto(t); gui.shootGoto(t);
} }
}; };
gui.notify = function (title, message) {
'use strict';
notifier.notify({
title: title,
message: message,
//icon: path.join(__dirname, 'coulson.jpg'), // Absolute path (doesn't work on balloons)
sound: true, // Only Notification Center or Windows Toasters
wait: true // Wait with callback, until user action is taken against notification
}, function (err, response) {
// Response is response from notification
});
};
gui.shootGoto = function (t) { gui.shootGoto = function (t) {
var elem = $(t), var elem = $(t),
id = elem.attr('id').split('_'), id = elem.attr('id').split('_'),