Skip to content

Commit

Permalink
refactor: slip another one in
Browse files Browse the repository at this point in the history
With async-await,
we can more clearly show that you send the info either way,
only awaiting the promise is guarded.
  • Loading branch information
lishaduck authored and jfmengels committed Nov 4, 2024
1 parent 31633ba commit 6e31f70
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/elm-app-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ if (parentPort) {
* @returns {void}
*/
function subscribe(parentPort) {
parentPort.on('message', ([port, data]) => {
parentPort.on('message', async ([port, data]) => {
if (port === 'startReview' || port === 'startGeneratingSuppressions') {
loadCachePromise.then(() => {
app.ports[port].send(data);
});
} else {
app.ports[port].send(data);
await loadCachePromise;
}

app.ports[port].send(data);
});

app.ports.requestReadingFiles.subscribe((data) => {
Expand Down

0 comments on commit 6e31f70

Please sign in to comment.