MCPcopy Create free account
hub / github.com/botbotrobotics/BotBrain / requestWakeLock

Function requestWakeLock

frontend/src/hooks/useWakeLock.ts:9–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7
8 useEffect(() => {
9 const requestWakeLock = async () => {
10 try {
11 if ('wakeLock' in navigator) {
12 wakeLockRef.current = await navigator.wakeLock.request('screen');
13 console.log('Wake Lock activated');
14
15 wakeLockRef.current.addEventListener('release', () => {
16 console.log('Wake Lock released');
17 });
18 }
19 } catch (err) {
20 console.error('Wake Lock request failed:', err);
21 }
22 };
23
24 const handleVisibilityChange = () => {
25 if (wakeLockRef.current && document.visibilityState === 'visible') {

Callers 2

handleVisibilityChangeFunction · 0.85
useWakeLockFunction · 0.85

Calls 1

logMethod · 0.80

Tested by

no test coverage detected