react-extended-hooks
Version:
A collection of React custom hooks providing extended functionality for geolocation, platform details, battery status, and more.
82 lines (67 loc) • 2.63 kB
TypeScript
export declare interface BatteryDetails {
charging: boolean;
level: number;
chargingTime: number | null;
dischargingTime: number | null;
}
export declare interface ClipBoardDetails {
copiedText: string;
isCopied: boolean;
clipboardContent: string;
copyToClipboard: (text: string) => Promise<void>;
readFromClipboard: () => Promise<void>;
}
export declare interface GeolocationDetails {
latitude: number | null;
longitude: number | null;
accuracy: number | null;
altitude: number | null;
altitudeAccuracy: number | null;
heading: number | null;
speed: number | null;
timestamp: number | null;
error: GeolocationPositionError | null;
}
export declare interface PlatformDetails {
userAgent: string;
language: string;
onLine: boolean;
}
export declare interface SpeechSynthesisDetails {
isSpeaking: boolean;
voices: SpeechSynthesisVoice[];
speak: (text: string) => void;
cancel: () => void;
}
export declare function useBatteryDetails({ onChargingChange, onLevelChange, onChargingTimeChange, onDischargingTimeChange, }?: useBatteryDetailsProps): BatteryDetails | null;
export declare interface useBatteryDetailsProps {
onChargingChange?: (charging: boolean) => void;
onLevelChange?: (level: number) => void;
onChargingTimeChange?: (chargingTime: number | null) => void;
onDischargingTimeChange?: (dischargingTime: number | null) => void;
}
export declare function useClipBoardDetails(): ClipBoardDetails;
export declare function useGeolocationDetails({ enableHighAccuracy, timeout, maximumAge, enableWatch, }?: useGeolocationProps): GeolocationDetails;
export declare interface useGeolocationProps {
enableHighAccuracy?: boolean;
timeout?: number;
maximumAge?: number;
enableWatch?: boolean;
}
export declare function usePlatformDetails({ trackOnlineStatus, debounceDelay, initialDetails, }?: usePlatformDetailsProps): PlatformDetails;
export declare interface usePlatformDetailsProps {
trackOnlineStatus?: boolean;
debounceDelay?: number;
initialDetails?: Partial<PlatformDetails>;
}
export declare function useSpeechSynthesis({ onStart, onEnd, onError, rate, pitch, volume, voiceURI, }?: useSpeechSynthesisProps): SpeechSynthesisDetails;
export declare interface useSpeechSynthesisProps {
onStart?: () => void;
onEnd?: () => void;
onError?: (error: SpeechSynthesisErrorEvent) => void;
rate?: number;
pitch?: number;
volume?: number;
voiceURI?: string;
}
export { }