Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

Commit

Permalink
Revert badge code
Browse files Browse the repository at this point in the history
Badge is not updated while switching documents
  • Loading branch information
williambout committed Feb 19, 2017
1 parent fa9717c commit b506655
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions app/js/preload.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const {SpellCheckHandler, ContextMenuListener, ContextMenuBuilder} = require('electron-spellchecker');
const {remote } = require('electron');

window.spellCheckHandler = new SpellCheckHandler();
setTimeout(() => window.spellCheckHandler.attachToInput(), 1000);
Expand All @@ -9,22 +8,3 @@ window.spellCheckHandler.autoUnloadDictionariesOnBlur();

window.contextMenuBuilder = new ContextMenuBuilder(window.spellCheckHandler, null, true);
window.contextMenuListener = new ContextMenuListener((info) => { window.contextMenuBuilder.showPopupMenu(info); });

document.addEventListener('DOMContentLoaded', function(event) {
const notificationIndicator = document.querySelectorAll('.hp-notifications-badge')[0];

setTimeout(() => {
setBadge(notificationIndicator.textContent);
}, 200);

notificationIndicator.addEventListener('DOMCharacterDataModified', (event) => {
setBadge(event.newValue);
});

function setBadge(newValue) {
if (newValue !== '0')
remote.app.dock.setBadge(newValue);
else
remote.app.dock.setBadge('');
}
});

0 comments on commit b506655

Please sign in to comment.