Interface: UseImpressionOptions
Defined in: use-impression.ts:6
Options for useImpression.
Properties
enabled?
optionalenabled?:boolean
Defined in: use-impression.ts:42
Set to false to stop observing and discard any running timer. Turning it
back on starts a fresh dwell timer. Default is true.
minDurationMs?
optionalminDurationMs?:number
Defined in: use-impression.ts:19
How long, in milliseconds, the element must stay at least threshold
visible before the impression is reported. Leaving the viewport before
then resets the timer. A value of 0 reports as soon as the element is
visible. A negative or non-finite value falls back to the default.
Default is 1000.
once?
optionalonce?:boolean
Defined in: use-impression.ts:25
Report a single impression for the element. When false, the element can
be reported again each time it leaves the viewport and then stays visible
for minDurationMs again. Default is true.
root?
optionalroot?:Document|Element|null
Defined in: use-impression.ts:31
The element used as the viewport for the check. Pass a scrollable
container to track visibility inside it. Passing a new element
re-observes. Default is the browser viewport (null).
rootMargin?
optionalrootMargin?:string
Defined in: use-impression.ts:37
Grows or shrinks the root's box before computing visibility, using CSS
margin syntax, for example "-50px" to ignore a fixed header. Default is
"0px".
threshold?
optionalthreshold?:number
Defined in: use-impression.ts:11
How much of the element must be visible, from 0 to 1, to count as
seen. Values outside that range are clamped. Default is 0.5.