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

Commit

Permalink
Try to fix some remote object errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aluxian committed Mar 23, 2017
1 parent af4db70 commit d47bd9d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/scripts/renderer/components/keymap.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ Mousetrap.bind('esc', function () {
const enabled = prefs.get('close-with-esc');
log('close with esc shortcut, enabled:', enabled);
if (enabled) {
remote.getGlobal('application').mainWindowManager.window.close();
const mwm = remote.getGlobal('application').mainWindowManager;
if (mwm) {
mwm.window.close();
}
}
return enabled;
});
5 changes: 4 additions & 1 deletion src/scripts/renderer/preload/listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ remote.getCurrentWebContents().on('context-menu', function (event, params) {
params.isWindows7 = platform.isWindows7;
params = JSON.stringify(params);
log('sending context menu', event, params);
remote.getGlobal('application').mainWindowManager.openContextMenu(params);
const mwm = remote.getGlobal('application').mainWindowManager;
if (mwm) {
mwm.openContextMenu(params);
}
event.preventDefault();
});
5 changes: 4 additions & 1 deletion src/scripts/renderer/webview/listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ webView.addEventListener('page-title-updated', function () {

// clear badge either instantly or after delay
_delayedRemoveBadge = setTimeout(() => {
remote.getGlobal('application').mainWindowManager.notifCountChanged(count, badgeDataUrl);
const mwm = remote.getGlobal('application').mainWindowManager;
if (mwm && typeof mwm.notifCountChanged === 'function') {
mwm.notifCountChanged(count, badgeDataUrl);
}
}, count ? 0 : 1500);
});

Expand Down

0 comments on commit d47bd9d

Please sign in to comment.