Skip to content

Commit

Permalink
inline the if, fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Aug 1, 2022
1 parent 760bab5 commit 5ff1e64
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions web_src/js/features/stopwatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ export function initStopwatch() {
$(this).parent().trigger('submit');
});

// global stop watch (in the head_navbar), it should always work in any case either the EventSource or the TimerPoller is used.
// global stop watch (in the head_navbar), it should always work in any case either the EventSource or the PeriodicPoller is used.
const currSeconds = $('.stopwatch-time').attr('data-seconds');
if (currSeconds) {
updateStopwatchTime(currSeconds);
}

let usingPeriodicPoller = false;
// poll the stopwatch status periodically
const startPeriodicPoller = (timeout) => {
if (timeout <= 0 || !Number.isFinite(timeout)) return;
usingPeriodicPoller = true;
Expand Down Expand Up @@ -149,9 +148,8 @@ function clearStopwatchTimer() {
}
function updateStopwatchTime(seconds) {
const secs = parseInt(seconds);
if (!Number.isFinite(secs)) {
return;
}
if (!Number.isFinite(secs)) return;

clearStopwatchTimer();
const $stopwatch = $('.stopwatch-time');
const start = Date.now();
Expand Down

0 comments on commit 5ff1e64

Please sign in to comment.