README
VueHooks Core
Collection of essential composition functions for Vue.
npm i @vuehooks/core
or
yarn add @vuehooks/core
:rocket: Features
- Bundler-friendly only imports the functions you need.
- Well-documented and typed interfaces.
- Zero-config server-side rendering capability.
- Self-contained with no dependencies.
:fire: Functions
- Animations
useTimeout
— change variables state after a timeout.
useTimeoutFn
— call a function after a timeout.
- Browser
useLocalStorage
— manages a value in localStorage.
useSessionStorage
— manages a value in sessionStorage.
useClipboard
— copies text to clipboard.
useFullscreen
— display an element fullscreen.
useEventListener
— add event listeners to dom with ease.
useEventListenerElement
— add event listeners to element with ease.
useMediaQuery
— track the results of a media query programmatically.
- Sensors
useBattery
— tracks device batter state.
useGeolocation
— tracks geo location state of user's device.
useHover
— track if an element is being hovered over.
useLongPress
— track long press gestures.
usePrint
— track if user is printing.
useMouse
— track mouse position.
useMouseElement
— track mouse position in element.
useWindowSize
— track with and height of window.
useResizeObserver
— track the width and height of an element using
ResizeObserver.
- State
createGlobalState
— create state accessible in any component.
useClamp
— track state of a clamped number.
useCounter
— track state of a number.
useToggle
— track state of a boolean.
useMounted
— track if the component is mounted.
- Emitter
createEmitter
— create an emitter for an event bus.
useEventOn
— add event listeners to emitters.
- Miscellaneous
useWorker
— running heavy javascript file without blocking ui.
useWorkerFn
— running heavy task, without blocking ui.
useTimeout
— change variables state after a timeout.useTimeoutFn
— call a function after a timeout.
useLocalStorage
— manages a value in localStorage.useSessionStorage
— manages a value in sessionStorage.useClipboard
— copies text to clipboard.useFullscreen
— display an element fullscreen.useEventListener
— add event listeners to dom with ease.useEventListenerElement
— add event listeners to element with ease.useMediaQuery
— track the results of a media query programmatically.
useBattery
— tracks device batter state.useGeolocation
— tracks geo location state of user's device.useHover
— track if an element is being hovered over.useLongPress
— track long press gestures.usePrint
— track if user is printing.useMouse
— track mouse position.useMouseElement
— track mouse position in element.useWindowSize
— track with and height of window.useResizeObserver
— track the width and height of an element using ResizeObserver.
createGlobalState
— create state accessible in any component.useClamp
— track state of a clamped number.useCounter
— track state of a number.useToggle
— track state of a boolean.useMounted
— track if the component is mounted.
createEmitter
— create an emitter for an event bus.useEventOn
— add event listeners to emitters.
useWorker
— running heavy javascript file without blocking ui.useWorkerFn
— running heavy task, without blocking ui.