Check if stopwatch element empty (#15278)

release/v1.15
Kyle D 2021-04-05 10:45:01 -06:00 committed by GitHub
parent 16dea6cebd
commit e10d028b03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -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',
@ -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');