R
fn

useSupported

v0.0.1testeddemo

SSR-friendly way to check if a feature is supported

Examples

ts
const isSupported = useSupported(() => 'IntersectionObserver' in window);
ts
const isSupported = useSupported(() => 'ResizeObserver' in window);

Demo

Loading demo…

Signature

ts
export function useSupported(feature: () => unknown){ ... }

Parameters

ParameterTypeDescription
feature() => unknownThe feature to check for support

Returns

import("vue").ComputedRef<boolean>Whether the feature is supported