How to use the node-notifier.NotificationCenter 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 DefinitelyTyped / DefinitelyTyped / node-notifier / node-notifier-tests.ts View on Github external
var nn = require('node-notifier');

new nn.NotificationCenter(options).notify();
new nn.NotifySend(options).notify();
new nn.WindowsToaster(options).notify(options);
new nn.WindowsBalloon(options).notify(options);
new nn.Growl(options).notify(options);


//
// All notification options with their defaults:
//

var NotificationCenter2 = require('node-notifier').NotificationCenter;

var notifier2 = new NotificationCenter2({
    withFallback: false, // use Growl if <= 10.8?
    customPath: void 0 // Relative path if you want to use your fork of terminal-notifier
});

notifier2.notify({
    'title': void 0,
    'subtitle': void 0,
    'message': void 0,
    'sound': false, // Case Sensitive string of sound file (see below)
    'icon': 'Terminal Icon', // Set icon? (Absolute path to image)
    'contentImage': void 0, // Attach image? (Absolute path)
    'open': void 0, // URL to open on click
    'wait': false // if wait for notification to end
}, function(error: any, response: any) {
    console.log(response);
});
github DefinitelyTyped / DefinitelyTyped / node-notifier / node-notifier-tests.ts View on Github external
import NotifySend = require('node-notifier/notifiers/notifysend');
new NotifySend(options).notify();

import WindowsToaster = require('node-notifier/notifiers/toaster');
new WindowsToaster(options).notify();

import Growl = require('node-notifier/notifiers/growl');
new Growl(options).notify();

import WindowsBalloon = require('node-notifier/notifiers/balloon');
new WindowsBalloon(options).notify();


var nn = require('node-notifier');

new nn.NotificationCenter(options).notify();
new nn.NotifySend(options).notify();
new nn.WindowsToaster(options).notify(options);
new nn.WindowsBalloon(options).notify(options);
new nn.Growl(options).notify(options);


//
// All notification options with their defaults:
//

var NotificationCenter2 = require('node-notifier').NotificationCenter;

var notifier2 = new NotificationCenter2({
    withFallback: false, // use Growl if <= 10.8?
    customPath: void 0 // Relative path if you want to use your fork of terminal-notifier
});
github emsk / redmine-notifier / app / index.js View on Github external
const fs = require('fs');
  const notie = require('notie');

  const appName = app.getName();
  const appCopyright = 'Copyright (c) 2015-2019 emsk';

  let appDir = `${__dirname}.unpacked`; // Production
  try {
    fs.statSync(appDir);
  } catch (err) {
    appDir = __dirname; // Development
  }

  let nodeNotifier = require('node-notifier');
  if (isMac) {
    nodeNotifier = new nodeNotifier.NotificationCenter({
      customPath: `${appDir}/custom/terminal-notifier.app/Contents/MacOS/terminal-notifier`
    });
  } else {
    nodeNotifier = new nodeNotifier.WindowsToaster({
      customPath: `${appDir}/custom/SnoreToast.exe`
    });
  }

  const appIconFilePath = isMac ? null : `${appDir}/images/${colorIconFilename64}`;

  let notifierScreen = null;

  /**
   * Class to check updated issues.
   */
  class RedmineNotifier {
github uenify / musician / main.js View on Github external
return '#333333'
      break
    case 'white':
      return '#ffffff'
      break
    default:
      return '#ffffff'
      break
  }
}

const platform = process.platform

if (platform === 'darwin') {
  const NotificationCenter = require('node-notifier').NotificationCenter;
  notifier = new NotificationCenter({
    customPath: join(
      __dirname,
      'musician.app/Contents/MacOS/musician'
    )
  });
} else {
  notifier = require('node-notifier');
}

// Let electron reloads by itself when webpack watches changes in ./app/
if (isDev) require('electron-reload')(__dirname)

app.on('ready', () => {
  const mainWindow = new BrowserWindow({
    width: 425,
    height: 650,
github SiDevesh / Quark-Carlo / app / index.js View on Github external
)
    ) {
      req.abort();
      if (config.debug) {
        app.evaluate(url => window.alert(url), `Attempted to open external url: ${req.url()}\nHostname to enter in cli: ${new URL(req.url()).hostname}`);
      }
      app.evaluate(url => window.open(url), req.url());
    } else {
      req.continue();
    }
  });
  app.serveOrigin(new URL(config.url).origin);

  let notifierInstance = notifier;
  if (config.platform === 'macos') {
    notifierInstance = new notifier.NotificationCenter({
      customPath: path.join(path.dirname(path.dirname(process.argv[0])), 'Resources', 'terminal-notifier.app', 'Contents', 'MacOS', 'terminal-notifier'),
    });
  }

  notifierInstance.on('click', () => {
    app.mainWindow().bringToFront();
    app.evaluate(`window.Notification.getLastNotification().dispatchEvent(new Event('click'))`);
  });
  notifierInstance.on('timeout', () => {
    app.evaluate(`window.Notification.getLastNotification().dispatchEvent(new Event('close'))`);
  });

  await app.exposeFunction('notify', (serializedOpts) => {
    const opts = JSON.parse(serializedOpts);
    notifierInstance.notify({
      title: opts.title,
github jpchip / giveaway-grabber / src / utils.js View on Github external
function sendSystemNotification(notification) {
	new nn.NotificationCenter().notify(notification);
	new nn.NotifySend().notify(notification);
	new nn.WindowsToaster().notify(notification);
	//new nn.WindowsBalloon().notify(notification);
	new nn.Growl().notify(notification);
}