Skip to content

Instantly share code, notes, and snippets.

@Jonas74
Last active September 28, 2015 15:09
Show Gist options
  • Select an option

  • Save Jonas74/5db766265c21a591890f to your computer and use it in GitHub Desktop.

Select an option

Save Jonas74/5db766265c21a591890f to your computer and use it in GitHub Desktop.

Prerequisits

brew install terminal-notifier
// https://github.com/julienXX/terminal-notifier

Code

var shell= require("shelljs");

var notify = module.exports = function(params) {
  
  return new Promise(function(resolve) {
    
    var command = [];

    command.push('terminal-notifier');
    //io.brackets.appshell
    if( params.sender ) {
      command.push('-sender "'+params.sender+'"');
    }
    if( params.title ) {
      command.push('-title "'+params.title+'"');
    }
    if( params.subtitle ) {
      command.push('-subtitle "'+params.subtitle+'"');
    }
    if( params.message ) {
      command.push('-message "'+params.message+'"');
    }
    if( params.sound ) {
      // Basso Glass Ping
      command.push('-sound "'+param.sound+'"');
    }
    //command.push('-appIcon "./test/asset/Icon1024.png"');
    //command.push('-open "https://www.epha.ch"');
    if( params.image ) {
      command.push('-contentImage "'+params.image+'"');
    }

    shell.exec( command.join(" ") );
  });
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment