MCPcopy
hub / github.com/philc/vimium / initWindowIsFocused

Function initWindowIsFocused

content_scripts/vimium_frontend.js:17–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15}
16
17function initWindowIsFocused() {
18 DomUtils.documentReady().then(() => windowHasFocus = document.hasFocus());
19 globalThis.addEventListener(
20 "focus",
21 forTrusted(function (event) {
22 if (event.target === window) {
23 windowHasFocus = true;
24 }
25 return true;
26 }),
27 true,
28 );
29 globalThis.addEventListener(
30 "blur",
31 forTrusted(function (event) {
32 if (event.target === window) {
33 windowHasFocus = false;
34 }
35 return true;
36 }),
37 true,
38 );
39}
40
41// True if this window should be focusable by various Vim commands (e.g. "nextFrame").
42function isWindowFocusable() {

Callers 1

vimium_frontend.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected