Improve async/await usage, and sort init calls in index.js (#17386)

* clean up async/await, and sort init calls in `index.js
* use `const _promise` to indicate that we do not need await an async function
This commit is contained in:
wxiaoguang 2021-11-09 17:27:25 +08:00 committed by GitHub
parent 3a693bd18c
commit bb71ceeeb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 223 additions and 211 deletions

View file

@ -3,7 +3,7 @@ const {appSubUrl, csrfToken, notificationSettings, enableTimeTracking} = window.
let updateTimeInterval = null; // holds setInterval id when active
export async function initStopwatch() {
export function initStopwatch() {
if (!enableTimeTracking) {
return;
}
@ -135,7 +135,7 @@ async function updateStopwatchData(data) {
$('.stopwatch-cancel').attr('action', `${issueUrl}/times/stopwatch/cancel`);
$('.stopwatch-issue').text(`${repo_owner_name}/${repo_name}#${issue_index}`);
$('.stopwatch-time').text(prettyMilliseconds(seconds * 1000));
updateStopwatchTime(seconds);
await updateStopwatchTime(seconds);
btnEl.removeClass('hidden');
}