Skip to content

Commit

Permalink
Fix timer stopped when the window in the background (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
seachicken authored May 22, 2022
1 parent b14af9b commit bfa57cf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/pomodoro-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Core, { getReplacementRange } from '@seachicken/pomodoro-edit-core';
let _tray;
let _disposables = new CompositeDisposable();
let _core;
let _backgroundThrottling;

export function activate() {
if (!inkdrop.isMainWindow) return;
Expand All @@ -18,6 +19,9 @@ export function activate() {
const modulePath = `${app.getAppPath()}/node_modules`;
require(`${modulePath}/codemirror/addon/hint/show-hint`);

_backgroundThrottling = inkdrop.window.webContents.backgroundThrottling;
inkdrop.window.webContents.backgroundThrottling = false;

if (process.platform === 'win32') {
_tray = new Tray(`${__dirname}/../resources/icon.ico`);
} else {
Expand All @@ -40,6 +44,7 @@ export function deactivate() {
_core.closeServer();
_core.stopTimer();
_tray.destroy();
inkdrop.window.webContents.backgroundThrottling = _backgroundThrottling;
}

function _registerCommands(editor) {
Expand Down

0 comments on commit bfa57cf

Please sign in to comment.