@greenlabs/rescript-hammerjs

2.0.0 • Public • Published

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)
      },
    )
  })

Package Sidebar

Install

npm i @greenlabs/rescript-hammerjs

Weekly Downloads

59

Version

2.0.0

License

MIT

Unpacked Size

3.79 kB

Total Files

5

Last publish

Collaborators

  • minukang
  • gyeop
  • miryangjung
  • jaeholee.gl
  • namenu
  • moondaddi
  • yousleepwhen
  • kimchhickey