diff --git a/demo/win.html b/demo/win.html index c4bece32..fe18a2ae 100644 --- a/demo/win.html +++ b/demo/win.html @@ -6,4 +6,19 @@ Test Window has been opened

+ +
+

Badge Count:

+ +
+ + diff --git a/js/preload/preloadMain.js b/js/preload/preloadMain.js index ffc340ee..5be794c2 100644 --- a/js/preload/preloadMain.js +++ b/js/preload/preloadMain.js @@ -19,22 +19,26 @@ const apiCmds = apiEnums.cmds; const apiName = apiEnums.apiName; const getMediaSources = require('../desktopCapturer/getSources'); +require('../downloadManager/downloadManager'); + // bug in electron preventing us from using spellchecker in pop outs // https://github.com/electron/electron/issues/4025 // so loading the spellchecker in try catch so that we don't // block other method from loading -try { - const SpellCheckerHelper = require('../spellChecker/spellChecker').SpellCheckHelper; - // Method to initialize spell checker - const spellChecker = new SpellCheckerHelper(); - spellChecker.initializeSpellChecker(); -} catch (err){ - /* eslint-disable no-console */ - console.error('requiring spellchecker module: ' + err); - /* eslint-enable no-console */ -} - -require('../downloadManager/downloadManager'); +document.addEventListener('DOMContentLoaded', () => { + try { + /* eslint-disable global-require */ + const SpellCheckerHelper = require('../spellChecker/spellChecker').SpellCheckHelper; + /* eslint-enable global-require */ + // Method to initialize spell checker + const spellChecker = new SpellCheckerHelper(); + spellChecker.initializeSpellChecker(); + } catch (err) { + /* eslint-disable no-console */ + console.error('requiring spellchecker module: ' + err); + /* eslint-enable no-console */ + } +}); const nodeURL = require('url'); diff --git a/js/spellChecker/spellChecker.js b/js/spellChecker/spellChecker.js index 2a8a2092..257de828 100644 --- a/js/spellChecker/spellChecker.js +++ b/js/spellChecker/spellChecker.js @@ -17,7 +17,7 @@ class SpellCheckHelper { const contextMenuBuilder = new ContextMenuBuilder(this.spellCheckHandler, null, false, SpellCheckHelper.processMenu); this.contextMenuListener = new ContextMenuListener((info) => { contextMenuBuilder.showPopupMenu(info); - }, null, null); + }); } /** diff --git a/package.json b/package.json index 2f8ba87c..9ed9ad74 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "unpacked-win": "npm run prebuild && npm run test && build --win --x64 --dir", "unpacked-win-x86": "npm run prebuild && npm run test && build --win --ia32", "prebuild": "npm run rebuild && npm run browserify-preload", - "browserify-preload": "browserify -o js/preload/_preloadMain.js -x electron --insert-global-vars=__filename,__dirname js/preload/preloadMain.js --external electron-spellchecker js/preload/preloadMain.js > js/preload/_preloadMain.js", + "browserify-preload": "browserify -o js/preload/_preloadMain.js -x electron --insert-global-vars=__filename,__dirname js/preload/preloadMain.js --exclude electron-spellchecker", "rebuild": "electron-rebuild -f", "test": "npm run lint && jest --verbose --testPathPattern test && npm run rebuild", "spectron-test": "jest --config tests/spectron/jest_spectron.json --runInBand && npm run rebuild",