@versini/ui-utilities
v1.4.1
Published
[](https://www.npmjs.com/package/@versini/ui-utilities)  => void, wait: number)Parameters:
func- The function to debouncewait- The number of milliseconds to delay
Returns: A new debounced function
Example:
const handleResize = debounce(() => {
console.log("Window resized");
}, 300);
window.addEventListener("resize", handleResize);isProbablyMobile
Determines if the current viewport width suggests a mobile device. Uses a width threshold of 403 pixels.
const isMobile = isProbablyMobile(): booleanReturns: true if the viewport width is less than 403 pixels
Example:
if (isProbablyMobile()) {
// Render mobile-specific UI
}isProbablyTablet
Determines if the current viewport width suggests a tablet device. Uses a width range between 403 and 1220 pixels.
const isTablet = isProbablyTablet(): booleanReturns: true if the viewport width is between 403 and 1220 pixels (inclusive)
Example:
if (isProbablyTablet()) {
// Render tablet-specific UI
}isProbablyiPhone
Attempts to detect if the current device is likely an iPhone. Uses a combination of platform detection, user agent analysis, screen size, and touch capability checks.
const isiPhone = isProbablyiPhone(): booleanReturns: true if the device is likely an iPhone
Example:
if (isProbablyiPhone()) {
// Apply iPhone-specific behavior
}isProbablyiPad
Attempts to detect if the current device is likely an iPad. Uses a combination of platform detection, user agent analysis, screen size, and touch capability checks.
const isiPad = isProbablyiPad(): booleanReturns: true if the device is likely an iPad
Example:
if (isProbablyiPad()) {
// Apply iPad-specific behavior
}isPWAMode
Detects if the app is running in standalone/PWA mode. Checks for both the standard display-mode media query and the iOS-specific standalone property.
const isPWA = isPWAMode(): booleanReturns: true if the app is running as a standalone PWA
Example:
if (isPWAMode()) {
// Hide browser-specific UI elements
}