Logical AND (&&) operator: I've used the logical AND (&&) operator to conditionally execute the addEventListener method. In JavaScript, if the first operand of the && operator is falsy, the second operand is not evaluated. This makes the code more concise and eliminates the need for an if statement.

testing_refactoring
richrobber2 2024-06-12 03:52:10 -07:00
parent a6dbceec24
commit 436419230f
1 changed files with 1 additions and 3 deletions

View File

@ -1325,9 +1325,7 @@ onUiLoaded(async () => {
}
};
if (isExtension) {
targetElement.addEventListener("mousemove", checkForOutBox);
}
isExtension && targetElement.addEventListener("mousemove", checkForOutBox);
// Prevents sticking to the mouse
window.onblur = function () {