Skip to content

Commit

Permalink
Check if stopwatch element empty
Browse files Browse the repository at this point in the history
  • Loading branch information
kdumontnu committed Apr 5, 2021
1 parent 16dea6c commit c9a3c26
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions web_src/js/features/stopwatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ export async function initStopwatch() {
}

const stopwatchEl = $('.active-stopwatch-trigger');

if (!stopwatchEl.length) {
return;
}

stopwatchEl.removeAttr('href'); // intended for noscript mode only
stopwatchEl.popup({
position: 'bottom right',
Expand All @@ -20,10 +25,6 @@ export async function initStopwatch() {
$(this).parent().trigger('submit');
});

if (!stopwatchEl) {
return;
}

if (NotificationSettings.EventSourceUpdateTime > 0 && !!window.EventSource && window.SharedWorker) {
// Try to connect to the event source via the shared worker first
const worker = new SharedWorker(`${__webpack_public_path__}js/eventsource.sharedworker.js`, 'notification-worker');
Expand Down

0 comments on commit c9a3c26

Please sign in to comment.