This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useEffect, useState } from "react"; | |
| interface NetworkInformation extends EventTarget { | |
| downlink?: number; | |
| effectiveType?: "slow-2g" | "2g" | "3g" | "4g"; | |
| rtt?: number; | |
| saveData?: boolean; | |
| onchange?: EventListener; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useCallback, useEffect, useState } from "react"; | |
| interface DeviceOrientationState { | |
| alpha: number | null; | |
| beta: number | null; | |
| gamma: number | null; | |
| absolute: boolean; | |
| } | |
| // Define an extended interface for DeviceOrientationEvent including requestPermission |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useEffect, useState } from "react"; | |
| /** | |
| * useDebounce hook | |
| * This hook allows you to debounce any fast changing value. The debounced value will only | |
| * reflect the latest value when the useDebounce hook has not been called for the specified delay period. | |
| * | |
| * @param value - The value to be debounced. | |
| * @param delay - The delay in milliseconds for the debounce. | |
| * @returns The debounced value. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useEffect, useState } from "react"; | |
| interface LocationOptions { | |
| enableHighAccuracy?: boolean; | |
| timeout?: number; | |
| maximumAge?: number; | |
| } | |
| interface LocationState { | |
| coords: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useEffect, useState } from "react"; | |
| type UseTextSelectionReturn = { | |
| text: string; | |
| rects: DOMRect[]; | |
| ranges: Range[]; | |
| selection: Selection | null; | |
| }; | |
| const getRangesFromSelection = (selection: Selection): Range[] => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useEffect, useRef } from "react"; | |
| type GestureType = | |
| | "swipeUp" | |
| | "swipeDown" | |
| | "swipeLeft" | |
| | "swipeRight" | |
| | "tap" | |
| | "pinch" | |
| | "zoom"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useCallback, useEffect, useState } from "react"; | |
| // Define custom types for SpeechRecognition and SpeechRecognitionEvent | |
| interface ISpeechRecognitionEvent extends Event { | |
| results: SpeechRecognitionResultList; | |
| resultIndex: number; | |
| } | |
| interface ISpeechRecognition extends EventTarget { | |
| lang: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useCallback, useEffect, useRef, useState } from "react"; | |
| interface UseBroadcastChannelOptions { | |
| name: string; | |
| onMessage?: (event: MessageEvent) => void; | |
| onMessageError?: (event: MessageEvent) => void; | |
| } | |
| interface UseBroadcastChannelReturn<D, P> { | |
| isSupported: boolean; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useEffect, useState } from "react"; | |
| import resolveConfig from "tailwindcss/resolveConfig"; | |
| // Update the path to your Tailwind config file | |
| import tailwindConfig from "tailwind.config"; | |
| const useTailwindBreakpoint = ({ | |
| onBreakpointChange, | |
| }: { | |
| // eslint-disable-next-line no-unused-vars |
NewerOlder