How to determine that the browser window has lost focus?

The tab remains the same, the browser window does not turn off. Just open the calculator app or just switch to any other app in the system, for example a text editor or another browser.

document.visibilityState in this case will be visible
March 20th 20 at 11:42
2 answers
March 20th 20 at 11:44
Solution
window.addEventListener("blur", () => {console.log(111)})
March 20th 20 at 11:46
Solution
window.onblur = () => console.log('noo')
also here is the link: https://developer.mozilla.org/en-US/docs/Web/API/P...

Find more questions by tags JavaScriptBrowsers