On this pageFunctions
Task
Programmatically clicks an element matching the given selector.
Uses requestAnimationFrame to ensure the DOM is updated before attempting to click.
Fails with ElementNotFound if the selector does not match an HTMLElement.
(selector: string): Effect<void, ElementNotFound>Closes a dialog element using .close().
Uses requestAnimationFrame to ensure the DOM is updated before attempting to close.
Fails with ElementNotFound if the selector does not match an HTMLDialogElement.
(selector: string): Effect<void, ElementNotFound>Waits for the given duration before completing. Useful for debouncing, such as clearing a typeahead search query.
(duration: DurationInput): Effect<void>Focuses an element matching the given selector.
Uses requestAnimationFrame to ensure the DOM is updated before attempting to focus.
Fails with ElementNotFound if the selector does not match an HTMLElement.
(selector: string): Effect<void, ElementNotFound>Gets the current time in a specific timezone.
Fails with TimeZoneError if the timezone ID is invalid.
(zoneId: string): Effect<Zoned, TimeZoneError>Generates a random integer between min (inclusive) and max (exclusive).
(
min: number,
max: number
): Effect<number>Scrolls an element into view by selector using { block: 'nearest' }.
Uses requestAnimationFrame to ensure the DOM is updated before attempting to scroll.
Fails with ElementNotFound if the selector does not match an HTMLElement.
(selector: string): Effect<void, ElementNotFound>Opens a dialog element as a modal using showModal().
Uses requestAnimationFrame to ensure the DOM is updated before attempting to show.
Fails with ElementNotFound if the selector does not match an HTMLDialogElement.
(selector: string): Effect<void, ElementNotFound>Waits for all CSS transitions on the element matching the selector to complete. Uses the Web Animations API for reliable detection. Falls back to completing immediately if the element is missing or has no active transitions.
(selector: string): Effect<void>