Merge pull request #4 from gfpacheco/badge-not-osx

Fix #3 - Prevent call to setBadge when not on OSX
This commit is contained in:
Jia Hao 2015-08-07 14:24:50 +08:00
commit e987b6425f
1 changed files with 5 additions and 4 deletions

View File

@ -41,7 +41,9 @@ app.on('ready', function() {
// if the window is focused, clear the badge
mainWindow.on('focus', function () {
app.dock.setBadge('');
if (process.platform === 'darwin') {
app.dock.setBadge('');
}
});
mainWindow.on('closed', function() {
@ -51,9 +53,8 @@ app.on('ready', function() {
// listen for a notification message
ipc.on('notification-message', function(event, arg) {
console.log(arg); // prints "ping"
if (arg === 'TITLE_CHANGED') {
if (!mainWindow.isFocused()) {
if (process.platform === 'darwin' && !mainWindow.isFocused()) {
app.dock.setBadge('●');
}
}
@ -61,4 +62,4 @@ ipc.on('notification-message', function(event, arg) {
app.on('window-all-closed', function() {
app.quit();
});
});