Module
React.Keybind.Types
- Package
- purescript-react-keybind
- Repository
- EpicOrange/purescript-react-keybind
This module contains Purescript versions of types in
the original react-keybind
library.
Although all types are exported, ShortcutSpec
and WithShortcutProps
are likely the only two types you'll need from here.
Component WithShortcutProps
is the type you pass into withShortcut
:
import React.Basic.Hooks (Component)
import React.Basic.Hooks as React
myComponent :: Component WithShortcutProps
myComponent = React.component "MyComponent" \{ shortcut } -> ...
myShortcutComponent :: Component {}
myShortcutComponent = withShortcut "MyShortcutComponent" myComponent
ShortcutSpec
is the type you pass into
registerShortcut
and registerSequenceShortcut
:
let myShortcut :: ShortcutSpec
myShortcut = { method: handler_ doSomething, keys: ["ctrl+h", "cmd+h"], ... }
_ <- registerShortcut myShortcut
#ShortcutSpec Source
type ShortcutSpec = Record ShortcutSpecRow
#ShortcutSpecRow Source
type ShortcutSpecRow = (description :: String, holdDuration :: Maybe Number, keys :: Array String, method :: EventHandler, title :: String)
#WithShortcutPropsRow Source
type WithShortcutPropsRow = (shortcut :: ProviderRenderProps)
#ProviderProps Source
type ProviderProps = Record ProviderPropsRow