From 2697d9f7212112e1d1d513288d8ab48fe855fa14 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 22 Apr 2016 14:34:16 -0400 Subject: [PATCH] Add notifier --- app/src/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/src/index.js b/app/src/index.js index bbfa8c7..bef3159 100644 --- a/app/src/index.js +++ b/app/src/index.js @@ -1,5 +1,6 @@ var remote = require('remote'), dialog = require('electron').remote.dialog, + notifier = require('node-notifier'), fs = require('fs'), uuid = require('node-uuid'), moment = require('moment'), @@ -175,6 +176,7 @@ seq.run = function () { } else { 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 $('.row input').removeClass('h'); $('#numbers div').removeClass('h'); @@ -900,6 +902,18 @@ gui.counterFormat = function (t, normal, prevent) { 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) { var elem = $(t), id = elem.attr('id').split('_'),