Pulled ALL skills from 15 source repositories: - anthropics/skills: 16 (docs, design, MCP, testing) - obra/superpowers: 14 (TDD, debugging, agents, planning) - coreyhaines31/marketingskills: 25 (marketing, CRO, SEO, growth) - better-auth/skills: 5 (auth patterns) - vercel-labs/agent-skills: 5 (React, design, Vercel) - antfu/skills: 16 (Vue, Vite, Vitest, pnpm, Turborepo) - Plus 13 individual skills from various repos Mosaic Stack is not limited to coding — the Orchestrator and subagents serve coding, business, design, marketing, writing, logistics, analysis, and more. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
51 lines
1.7 KiB
Markdown
51 lines
1.7 KiB
Markdown
---
|
|
category: Browser
|
|
---
|
|
|
|
# useWakeLock
|
|
|
|
Reactive [Screen Wake Lock API](https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API). Provides a way to prevent devices from dimming or locking the screen when an application needs to keep running.
|
|
|
|
## Usage
|
|
|
|
```ts
|
|
import { useWakeLock } from '@vueuse/core'
|
|
|
|
const { isSupported, isActive, forceRequest, request, release } = useWakeLock()
|
|
```
|
|
|
|
When `request` is called, the wake lock will be requested if the document is visible. Otherwise, the request will be queued until the document becomes visible. If the request is successful, `isActive` will be **true**. Whenever the document is hidden, the `isActive` will be **false**.
|
|
|
|
When `release` is called, the wake lock will be released. If there is a queued request, it will be canceled.
|
|
|
|
To request a wake lock immediately, even if the document is hidden, use `forceRequest`. Note that this may throw an error if the document is hidden.
|
|
|
|
## Type Declarations
|
|
|
|
```ts
|
|
type WakeLockType = "screen"
|
|
export interface WakeLockSentinel extends EventTarget {
|
|
type: WakeLockType
|
|
released: boolean
|
|
release: () => Promise<void>
|
|
}
|
|
export type UseWakeLockOptions = ConfigurableNavigator & ConfigurableDocument
|
|
/**
|
|
* Reactive Screen Wake Lock API.
|
|
*
|
|
* @see https://vueuse.org/useWakeLock
|
|
* @param options
|
|
*
|
|
* @__NO_SIDE_EFFECTS__
|
|
*/
|
|
export declare function useWakeLock(options?: UseWakeLockOptions): {
|
|
sentinel: ShallowRef<WakeLockSentinel | null, WakeLockSentinel | null>
|
|
isSupported: ComputedRef<boolean>
|
|
isActive: ComputedRef<boolean>
|
|
request: (type: WakeLockType) => Promise<void>
|
|
forceRequest: (type: WakeLockType) => Promise<void>
|
|
release: () => Promise<void>
|
|
}
|
|
export type UseWakeLockReturn = ReturnType<typeof useWakeLock>
|
|
```
|