Browser
The Browser module provides a collection of utilities for interacting with web browser APIs. It includes functions for managing fullscreen mode, detecting connection status, handling DOM events, controlling page scrolling, and accessing native features like sharing. It also offers methods to check user preferences and device capabilities.
Overview
exitFullscreen(): voidExits fullscreen mode, if supported by the browser.
getLanguage(): stringReturns the user's preferred browser language.
getTheme(): "light" | "dark"Gets the user's preferred theme (light or dark).
isCookieEnabled(): booleanChecks if cookies are enabled in the browser.
isFullscreenEnabled(): booleanChecks if the fullscreen API is available.
isOnline(): booleanChecks if the browser is connected to the internet.
isShareable(): booleanChecks if the native sharing API is available.
isTabActive(): booleanChecks if the browser tab is active (visible).
isTouchDevice(): booleanChecks if the device supports touch events.
on<K extends keyof HTMLElementEventMap>(target: HTMLElement | Document | Window, type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): voidAdds an event listener to a DOM element.
onOffline(listener: () => void): voidAdds a listener for the offline event.
onOnline(listener: () => void): voidAdds a listener for the online event.
onVisibilityChange(listener: () => void): voidAdds a listener for tab visibility changes.
requestFullscreen(element?: HTMLElement): voidRequests an element to enter fullscreen mode.
scrollToElement(target: string | HTMLElement, options?: ScrollIntoViewOptions): voidSmoothly scrolls to a target element on the page.
scrollToTop(options?: ScrollToOptions): voidSmoothly scrolls to the top of the page.
share(data: ShareData): Promise<void>Uses the native API to share data such as title, text, URL, or files.
