Introduction
Hamo means hook, you do the math
🚧 This package is not stable, API might change at any time 🚧
Setup
$ npm i @studio-freight/hamo
or use whatever package manager you like the most
Features
This toolkit is composed of:
useOutsideClickEvent
– trigger a callback when user clicks outside of a reference node.
useDebug
– returns true if #debug, ?debug or /_debug is present in the url.
useDocumentReadyState
– returns document.readyState
.
useFrame
– use @studio-freight/tempus
animation frame.
useInterval
– run a callback every x milliseconds.
useIsClient
– returns true if window is defined.
useIsTouchDevice
– returns true if client is using a touch-capable device.
useIntersectionObserver
– returns a setRef and the intersection
object, which will have the method .intersecting
as true or false depending on the configurations passed to the hook.
useMediaQuery
– css-like media query support in Javascript.
useRect
– return getBoundingClientRect
useSlots
– brings vue slots
to react
useResizeObserver
– observe elements dimensions using ResizeObserver
useWindowSize
– listens to window size and returns width and height.
Authors
This set of hooks is curated and maintained by the Studio Freight Darkroom team:
- Clement Roche (@clementroche_) – Studio Freight
- Guido Fier (@uido15) – Studio Freight
- Leandro Soengas (@lsoengas) - Studio Freight
- Franco Arza (@arzafran) - Studio Freight