forked from purescript-react/purescript-react-basic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTypes.purs
More file actions
38 lines (29 loc) · 1.1 KB
/
Types.purs
File metadata and controls
38 lines (29 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
module React.Basic.Types where
import Prelude
import Control.Monad.Eff (kind Effect)
import Control.Monad.Eff.Uncurried (EffFn1)
-- | A virtual DOM element.
foreign import data JSX :: Type
-- | A React component which can be used from JavaScript.
foreign import data ReactComponent :: Type -> Type
-- | A placeholder effect for all React FFI.
foreign import data ReactFX :: Effect
-- | An _actual_ DOM node (not a virtual DOM element!)
foreign import data DOMNode :: Type
-- | An abstract type representing records of CSS attributes.
foreign import data CSS :: Type
-- | Event data that we receive from React.
type SyntheticEvent =
{ bubbles :: Boolean
, cancelable :: Boolean
, currentTarget :: DOMNode
, defaultPrevented :: Boolean
, eventPhase :: Number
, isTrusted :: Boolean
, target :: DOMNode
, timeStamp :: Number
, type :: String
}
-- | An event handler, which receives a `SyntheticEvent` and performs some
-- | effects in return.
type EventHandler = EffFn1 (react :: ReactFX) SyntheticEvent Unit