How to use the node-notifier.Notification 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 mikaelbr / node-notifier-cli / bin.js View on Github external
function doNotification(options) {
  var notifier = new Notification(options);
  if (!options.message) {
    // Do not show an empty message
    process.exit(0);
  }
  notifier.notify(options, function(err, msg) {
    if (err) {
      console.error(err.message);
      process.exit(1);
    }

    if (msg) console.log(msg);
    process.exit(0);
  });
}
github mikaelbr / gulp-notify / lib / extra_api.js View on Github external
module.exports.onError = function (options, callback) {
  var reporter;
  options = options || {};
  var templateOptions = options.templateOptions || {};
  var callback = callback || function (err) {
    err && logError({
      title: "Error running notifier",
      message: "Could not send message: " + err.message
    }, true);
  };

  if (options.notifier) {
    reporter = options.notifier;
  } else {
    if (options.host || options.appName || options.port) {
      notifier = new notifier.Notification({
        host: options.host || 'localhost',
        appName: options.appName || 'gulp-notify',
        port: options.port || '23053'
      });
    }
    reporter = notifier.notify.bind(notifier);
  }
  return function (error) {
    var self = this;
    report(reporter, error, options, templateOptions, function () {
      callback.apply(self, arguments);
      self.emit && self.emit('end');
    });
  };
};
github mikaelbr / gulp-notify / lib / notify.js View on Github external
module.exports = function (options) {
  var reporter;
  var lastFile = null;

  options = options || {};
  var templateOptions = options.templateOptions || {};

  if (options.notifier) {
    reporter = options.notifier;
  } else {
    if (options.host || options.appName || options.port) {
      notifier = new notifier.Notification({
        host: options.host || 'localhost',
        appName: options.appName || 'gulp-notify',
        port: options.port || '23053'
      });
    }
    reporter = notifier.notify.bind(notifier);
  }

  function notify (file, enc, callback) {
    var stream = this;

    report(reporter, file, options, templateOptions, function (err) {
      logError(err, stream);

      if (options.emitError) {
        stream.push(file);
github CookieCollective / 4k-Demo-Oven / scripts / build.js View on Github external
.alias('help', 'h')
	.argv;

const config = require('./config');

const outputDirectory = 'dist';
const exePath = resolve(outputDirectory, config.get('demo:name') + '.exe');

let chain = require('./make-chain')(config, {
	debug : process.argv.includes('debug'),
	nominify : process.argv.includes('nominify'),
	buildDirectory: 'build',
	exePath,
});

const notifier = new Notification({
	withFallback: true,
});

const startTime = Date.now();

let size;

chain
	.then(() => {
		return stat(exePath);
	})
	.then(stats => {
		size = stats.size;

		if (argv.notify) {
			notifier.notify({