@greenlabs/rescript-hammerjs
v2.0.0
Published
ReScript bindings to @egjs/hammerjs
Downloads
17
Readme
rescript-hammerjs
ReScript binding of @egjs/hammerjs
Install
npm i @greenlabs/rescript-hammerjs
or
yarn add @greenlabs/rescript-hammerjs
"bs-dependencies": [
"@greenlabs/rescript-hammerjs"
]
Usage
React.useEffect0(_ => {
let swipeInstance =
ref.current
->Js.Nullable.toOption
->Option.mapWithDefault(None, el => Some(el->HammerJs.makeWithElement))
swipeInstance->Option.forEach(swipeInstance' =>
HammerJs.on(
swipeInstance',
#swipe,
event => {
Js.log(event)
},
)
)
Some(
_ => {
swipeInstance->Option.forEach(swipeInstance' => swipeInstance'->HammerJs.destroy)
},
)
})