main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
692 bytes
|
Line | |
---|
1 | import { registerAction, hoverAction } from '@use-gesture/core/actions'
|
---|
2 | import { EventTypes, UserHoverConfig, Handler } from '@use-gesture/core/types'
|
---|
3 | import { useRecognizers } from './useRecognizers'
|
---|
4 |
|
---|
5 | /**
|
---|
6 | * Hover hook.
|
---|
7 | *
|
---|
8 | * @param {Handler<'hover'>} handler - the function fired every time the hover gesture updates
|
---|
9 | * @param {UserHoverConfig} config - the config object including generic options and hover options
|
---|
10 | */
|
---|
11 | export function useHover<EventType = EventTypes['hover'], Config extends UserHoverConfig = UserHoverConfig>(
|
---|
12 | handler: Handler<'hover', EventType>,
|
---|
13 | config?: Config
|
---|
14 | ) {
|
---|
15 | registerAction(hoverAction)
|
---|
16 | return useRecognizers({ hover: handler }, config || {}, 'hover')
|
---|
17 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.