How to use the node-notifier.on function in node-notifier

To help you get started, we’ve selected a few node-notifier examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github supnate / command-pad / src / node / main_service.js View on Github external
const spawn = childProcess.spawn;
const exec = childProcess.exec;
const Convert = require('ansi-to-html');

const convert = new Convert();
const config = new Config();

const isWin = process.platform === 'win32';

const iconSuccessPath = path.join(__dirname, '../images/iconSuccess.png');
const iconErrorPath = path.join(__dirname, '../images/iconError.png');
// const iconSuccess = nativeImage.createFromPath(path.join(__dirname, '../images/iconSuccess.png'));
// const iconError = nativeImage.createFromPath(path.join(__dirname, '../images/iconError.png'));

notifier.on('click', () => {
  console.log('notifier on click');
  global.CP_WIN.show();
});

function guid() {
  return 'xyxyxyxy'.replace(/[xy]/g, (c) => {
    var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); // eslint-disable-line
    return v.toString(16);
  });
}

// Ensure immutable, don't know if config.get always returns new data.
const cmds = _.cloneDeep(config.get('cmds') || []);
for (const c of cmds) {
  c.outputs = [];
}
github gucong3000 / FELS / gulpfile.js View on Github external
// jshint错误汇报
		const reporter = require("./lib/gulp-reporter");

		stream = stream.pipe(reporter({
			browser: true
		}));
	}
	return stream;
}

var RcLoader = require("rcloader");
var rcCache = {};
var cacheNotification = {};
var notifyBasy;
var notifier = require("node-notifier");
notifier.on("timeout", function() {
	notifyBasy = false;
	notify();
});

function notify() {
	function show(filePath) {
		notifyBasy = true;
		var opts = cacheNotification[filePath];
		opts.message = "发现未规范化的代码,点击修复此问题。\n" + filePath;
		opts.sound = true;
		opts.time = 5000;
		opts.wait = true;
		notifier.notify(opts, function(err, response) {

			// Response is response from notification
			if (!err && response === "activate") {
github RoccoC / webpack-build-notifier / index.js View on Github external
* Any additional node-notifier options as documented in the node-notifer documentation:
     * https://github.com/mikaelbr/node-notifier
     * 
     * Note that options provided here will only be applied to the success/warning/error notifications
     * (not the "compilation started" notification). The title, message, sound, contentImage (logo), and icon
     * options will be ignored, as they will be set via the corresponding WebpackBuildNotifier config options
     * (either user-specified or default).
     */
    this.notifyOptions = cfg.notifyOptions || {};

    this.registerSnoreToast();

    // add notification click handler to activate terminal window
    notifier.on('click', this.onClick.bind(this));
    if (this.onTimeout) {
        notifier.on('timeout', this.onTimeout);
    }
};
github licoffe / POE-sniper / renderer.js View on Github external
var Filters          = require( "./filters.js" );
var Currency         = require( "./currency.js" );
var Chunk            = require( "./chunk.js" );

// Current leagues
var leagues         = config.leagues;
var filters         = new Filters([]);

var mu              = require( 'mu2' );
mu.root             = __dirname + '/templates';
const notifier      = require('node-notifier');
notifier.on( "timeout", function () {
    // displayingNotification = false;
});

notifier.on( "click", function () {
    // displayingNotification = false;
    Misc.formatMessage( lastItem, function( str ) {
        ncp.copy( str, function() {
            if ( config.visualNotification ) {
                notifier.notify({
                    'title': 'Message copied to clipboard',
                    'message': str,
                });
            }
        });
    });
});

var ncp             = require( "copy-paste" );
var editingFilter   = "";    // Are we editing filters at the moment
var downloading     = false; // Is the tool downloading chunks at the moment
github JiveOff / roPresence / index.js View on Github external
title: 'roPresence Loaded',
      message: 'Glad to see you, ' + robloxUser.robloxUsername + '!\nYour presence will be updated once you interact with ROBLOX.',
      sound: true,
      icon: path.join(__dirname, 'img/yes.png')
    })
    logToFile('Presence API: Your Discord presence will now be updated every 15 seconds with the ' + robloxUser.robloxUsername + ' ROBLOX Account.\nIf you unverify, roPresence will stop showing the Discord Presence and ask you to verify yourself again.\n\nTo keep the Discord Presence, DO NOT close this window. You can close it when you will be done.')
  }
}

async function getRoverUser () {
  const data = await Fetch('https://verify.eryn.io/api/user/' + RPC.user.id)
  const main = await data.json()
  return main
}

Notifier.on('click', function (notifyObject, opt) {
  if (opt.title === 'roPresence Error') {
    Open('https://verify.eryn.io/')
  } else if (opt.title === 'roPresence Discord Error' && Config.attemptToOpenDiscordOnConnectionFailurePopupClick === true && process.env.terminal !== '1') {
    Open('Discord.exe') // Leaving this as a "might work, not guaranteed" solution.
  } else if (opt.title === 'roPresence Tip') {
    Open('https://github.com/JiveOff/roPresence/blob/master/README.md#making-the-game-name-show')
  }
})

async function initSocket () {
  logToFile('Socket Client: Starting.')

  var socket = io.connect('http://presences.jiveoff.fr/client/subSocket', {
    reconnect: true,
    query: {
      robloxId: robloxUser.robloxId,
github jaruba / PowderWeb / server / index.js View on Github external
engine.on('complete', () => {
                    if (isMaster) {
                      const shouldNotify = config.get('torrentNotifs')

                      if (shouldNotify) {
                        notifier.notify({
                            title: 'Powder Web',
                            message: 'Torrent finished downloading',
                            icon: path.join(__dirname, '..', 'packaging', 'icons', 'powder-square.png'),
                            wait: true,
                          }, (err, response) => {
                            // Response is response from notification
                          }
                        )
                        notifier.on('click', (notifierObject, options) => {
                          streams.getPath(engine.infoHash, (folderPath) => {
                            if (folderPath) {
                              shell.openItem(folderPath)
                            }
                          })
                        })
                      }
                    }

                    // execute user set commands at end of download
                    // (yes, not only in isMaster case)

                    const userCommands = config.get('userCommands')

                    if (userCommands) {
github SyneticNL / Gulp-for-Drupal / gulpfile.js View on Github external
browserSync.init(settings, function(err, bs){
    var port = (bs.server._connectionKey).substr((bs.server._connectionKey).length - 4);
    var title = "Browsersync started",
        ip = 'localhost';
    if (mode === 'share'){
      title += " in share mode";
      ip = getIP();
    }
    notifier.notify({
      title: title,
      message: 'on ' + ip + ':' + port + '\nClick to launch browser',
      icon: path.join(__dirname, config.general.logopath),
      sound: config.general.sound,
      wait: true
    });
    notifier.on('click', function (notifierObject, options) {
      open("http://" + ip + ":" + port);
    });
  });
}
github dennisreimann / uiengine / packages / ui / build / utils.js View on Github external
return (severity, errors) => {
    if (severity !== 'error') return

    const error = errors[0]
    const filename = error.file && error.file.split('!').pop()

    notifier.notify({
      title: packageConfig.name,
      message: severity + ': ' + error.name,
      subtitle: filename || '',
      timeout: 5,
      icon: join(__dirname, 'logo.png')
    })

    notifier.on('click', () => {
      const exec = require('child_process').exec
      exec(`$EDITOR ${resolve(__dirname, '..', filename)}`)
    })
  }
}
github scholtzm / punk / src / ui / notifier / index.js View on Github external
const notifier = require('node-notifier');
const remote = require('electron').remote;

const Constants = require('../../constants');
const ChatActions = require('../../actions/chat-actions.js');
const SteamCommunityWindow = require('../windows/steam-community.js');
const urlHelper = require('../../utils/url-helper.js');

const soundPath = 'sounds/beep.mp3';
const iconPath = `${__dirname }/../../../../static/image/icon.png`;

notifier.on('click', (notifierObject, options) => {
  if(!options.meta) {
    return;
  }

  switch(options.meta.action) {
    case Constants.UIActions.UI_NOTIFICATION_OPEN_URL:
      const url = options.meta.url;

      if(urlHelper.isSteamUrl(url)) {
        SteamCommunityWindow.open(url);
      } else {
        urlHelper.openExternal(url);
      }
      break;

    case Constants.UIActions.UI_NOTIFICATION_SWITCH_CHAT: