📄 useEyeDropper¶
📊 Analysis Summary¶
| Metric | Count |
|---|---|
| 🔧 Functions | 2 |
| 📦 Imports | 4 |
| ⚡ Async/Await Patterns | 2 |
| 📐 Interfaces | 4 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 packages/core/useEyeDropper/index.ts
📦 Imports¶
| Name | Source |
|---|---|
ShallowRef |
vue |
Supportable |
../types |
shallowRef |
vue |
useSupported |
../useSupported |
Async/Await Patterns¶
| Type | Function | Await Expressions | Promise Chains |
|---|---|---|---|
| await-expression | useEyeDropper |
eyeDropper.open(openOptions) | none |
| async-function | open |
eyeDropper.open(openOptions) | none |
Functions¶
useEyeDropper(options: UseEyeDropperOptions): UseEyeDropperReturn¶
Reactive EyeDropper API
See: https://vueuse.org/useEyeDropper
Tags: @__NO_SIDE_EFFECTS__
Raw JSDoc
Calls:
useSupported (from ../useSupported)shallowRef (from vue)eyeDropper.open
Code
export function useEyeDropper(options: UseEyeDropperOptions = {}): UseEyeDropperReturn {
const { initialValue = '' } = options
const isSupported = useSupported(() => typeof window !== 'undefined' && 'EyeDropper' in window)
const sRGBHex = shallowRef(initialValue)
async function open(openOptions?: EyeDropperOpenOptions) {
if (!isSupported.value)
return
const eyeDropper: EyeDropper = new (window as any).EyeDropper()
const result = await eyeDropper.open(openOptions)
sRGBHex.value = result.sRGBHex
return result
}
return { isSupported, sRGBHex, open }
}
Internal helpers¶
Declared inside another function in this file.
open(openOptions: EyeDropperOpenOptions): Promise<{ sRGBHex: string; }>¶
Parameters:
openOptionsEyeDropperOpenOptions
Returns: Promise<{ sRGBHex: string; }>
Calls:
eyeDropper.open
Code
Interfaces¶
EyeDropperOpenOptions¶
Interface Code
Properties¶
| Name | Type | Optional | Description |
|---|---|---|---|
signal |
AbortSignal |
✓ | not shown |
EyeDropper¶
Interface Code
Properties¶
| Name | Type | Optional | Description |
|---|---|---|---|
open |
(options?: EyeDropperOpenOptions) => Promise<{ sRGBHex: string }> |
✗ | not shown |
[Symbol.toStringTag] |
'EyeDropper' |
✗ | not shown |
UseEyeDropperOptions¶
Interface Code
Properties¶
| Name | Type | Optional | Description |
|---|---|---|---|
initialValue |
string |
✓ | not shown |
UseEyeDropperReturn¶
Interface Code
Properties¶
| Name | Type | Optional | Description |
|---|---|---|---|
sRGBHex |
ShallowRef<string> |
✗ | not shown |
open |
(openOptions?: EyeDropperOpenOptions) => Promise<{ sRGBHex: string } \| undef... |
✗ | not shown |
Generated by Syntax Scribe