Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

Commit

Permalink
fix(Citations): Handle race condition with formatReferences
Browse files Browse the repository at this point in the history
formatReferences wasn't getting called consistently, causing the citation styles to not work.
  • Loading branch information
jwijay committed Oct 3, 2019
1 parent b2eab4b commit 38c6386
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/common/js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ export const formatReferences = (): void => {

const onReadyHandler = (): void => {
codeHighlight()
formatReferences()
window.setTimeout(formatReferences, 0)
}

export const load = (): void => {
if (document.readyState !== 'loading') {
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', onReadyHandler)
} else {
onReadyHandler()
}

document.addEventListener('DOMContentLoaded', onReadyHandler)
}

0 comments on commit 38c6386

Please sign in to comment.