Skip to content

Instantly share code, notes, and snippets.

@hanih
Last active August 29, 2015 14:11
Show Gist options
  • Select an option

  • Save hanih/16cf2468825bbe4e27f3 to your computer and use it in GitHub Desktop.

Select an option

Save hanih/16cf2468825bbe4e27f3 to your computer and use it in GitHub Desktop.
Simple Titanium Studio plugin that creates a notification with sound in Notifications Center when build is finished
/*
Simple Titanium Studio plugin that creates a notification with sound in Notifications Center
when build is finished
In the project directory create a folder plugins/io.wlm.notifier/1.0/hooks and copy this file inside.
The name of the js file is not important, you can also change the plugin name to whatever you want.
Install npm module node-notifier https://github.com/mikaelbr/node-notifier
or download it and copy it inside a node_modules folder at the same level as this file.
In Tiapp.xml add a reference to the plugin like
<plugins>
<plugin version="1.0">io.wlm.notifier</plugin>
</plugins>
This code was tested on my Mac
*/
exports.cliVersion = '>=3.X';
exports.init = function (logger, config, cli, appc) {
cli.addHook('build.post.compile', function (build, finished) {
logger.info('Build done');
var notifier = require('node-notifier');
notifier.notify({
'title': 'Done !',
'message': 'Build ready',
'sound': 'Purr'
});
// be sure to call finished()
finished();
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment