Skip to content

Commit

Permalink
Fix typo; defered -> deferred
Browse files Browse the repository at this point in the history
  • Loading branch information
tshino committed Mar 3, 2025
1 parent 5bc0102 commit 0ec7a10
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/reentrant_guard.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const reentrantGuard = (function() {
queueable: false
};
const queue = [];
const deferedFunctions = [];
const deferredFunctions = [];

let printError = defaultPrintError;
function defaultPrintError(error) {
Expand All @@ -20,9 +20,9 @@ const reentrantGuard = (function() {
return old;
};

const callDeferedFunctions = function() {
while (0 < deferedFunctions.length) {
const func = deferedFunctions.shift();
const callDeferredFunctions = function() {
while (0 < deferredFunctions.length) {
const func = deferredFunctions.shift();
func();
}
};
Expand All @@ -38,7 +38,7 @@ const reentrantGuard = (function() {
} catch (error) {
printError(error);
} finally {
callDeferedFunctions();
callDeferredFunctions();
state.locked = false;
}
};
Expand All @@ -54,7 +54,7 @@ const reentrantGuard = (function() {
} catch (error) {
printError(error);
} finally {
callDeferedFunctions();
callDeferredFunctions();
state.locked = false;
}
};
Expand Down Expand Up @@ -85,7 +85,7 @@ const reentrantGuard = (function() {
queue.splice(0, 1);
resolve();
} else {
callDeferedFunctions();
callDeferredFunctions();
state.locked = false;
state.queueable = false;
}
Expand All @@ -95,7 +95,7 @@ const reentrantGuard = (function() {
const callExclusively = async function(func) {
if (state.locked) {
await new Promise(resolve => {
deferedFunctions.push(() => {
deferredFunctions.push(() => {
func();
resolve();
});
Expand Down

0 comments on commit 0ec7a10

Please sign in to comment.