npm install @newstudios/hook
or
yarn add @newstudios/hook
useArrowKey
listen to arrow key state change and get the latest stateuseInvalidator
use invalidator to invalidate the target at the next animation frameuseCanvasInvalidator
a special invalidator to draw canvas at the next aniation frameuseClickAway
listen click event outside the targetuseDevicePixelRatio
listen to the device pixel ratio change and get the latest devicePixelRatiouseDrag
a simple hook to process the dragging state and callbackuseEvent
a hook to bind listener(s) to event targetuseHover
a hook to get the mouse hover state of the targetuseList
a hook to manage collectionsuseUpdate
get a static callback to force update the componentuseNextUpdate
get a static callback to update the componenent next event loopuseRaf
a hook to call requestAnimationFrame whose lifecycle is self manageduseRefObject
a hook to reference any object from the argumentuseResize
a hook to listen to the resize event of the targetuseResizeObserver
a hook to get the default or customed provided ResizeObserver instanceuseSafeClick
manage the click event from the target and assure the gesture not to be dragginguseSetupCanvas
a hook for setup the canvas and set the canvas width and height automaticallyuseShortcutKey
listen to the shortcut keyuseShortcutKeys
listen to the multiple shortcut keysuseThrottle
invoke a callback with throttleuseThrottleCallback
get a callback which will be invoked with throttle
MIT