Add Markdown support

This commit is contained in:
dwrz
2026-07-09 14:47:43 +00:00
parent 98986a884a
commit e0eed6a935
13 changed files with 184 additions and 14 deletions

View File

@@ -0,0 +1,49 @@
/**
* WakeLock manages the screen wake lock to prevent the display from
* dimming during active use (recording or processing).
*/
export class WakeLock {
constructor() {
this.wakeLock = null;
}
/**
* acquire requests a screen wake lock. Idempotent.
*/
async acquire() {
if (this.wakeLock) return;
if (!('wakeLock' in navigator)) return;
try {
this.wakeLock = await navigator.wakeLock.request('screen');
} catch (e) {
console.debug('wake lock acquire failed:', e);
}
}
/**
* release releases the active wake lock. Idempotent.
*/
async release() {
if (!this.wakeLock) return;
try {
await this.wakeLock.release();
} catch (e) {
console.debug('wake lock release failed:', e);
}
this.wakeLock = null;
}
/**
* handleVisibilityChange reacquires the wake lock when the tab
* becomes visible, if the app is currently active.
* @param {boolean} isActive - Whether the app is recording or processing.
*/
async handleVisibilityChange(isActive) {
if (document.visibilityState !== 'visible') return;
if (!isActive) return;
await this.acquire();
}
}