{-# LANGUAGE OverloadedStrings #-}
module Miso.Native.X.Element.Svg.Event
(
onLoad
, onLoadWith
, onLoadMain
, onLoadMainWith
, svgEvents
) where
import qualified Data.Map as M
import Miso.Event
import Miso.Types (Attribute, EventHandler, DOMRef)
svgEvents :: Events
svgEvents :: Events
svgEvents = [(MisoString, Phase)] -> Events
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList [ (MisoString
"load", Phase
BUBBLE) ]
onLoad :: action -> Attribute model action
onLoad :: forall action model. action -> Attribute model action
onLoad action
action = MisoString
-> Decoder ()
-> (() -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"load" Decoder ()
emptyDecoder (\() model
_ DOMRef
_ -> action
action)
onLoadMain :: action -> EventHandler model action
onLoadMain :: forall action model. action -> EventHandler model action
onLoadMain action
action = MisoString
-> Decoder ()
-> (() -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"load" Decoder ()
emptyDecoder (\() model
_ DOMRef
_ -> action
action)
onLoadMainWith :: (model -> DOMRef -> action) -> EventHandler model action
onLoadMainWith :: forall model action.
(model -> DOMRef -> action) -> EventHandler model action
onLoadMainWith model -> DOMRef -> action
action = MisoString
-> Decoder ()
-> (() -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"load" Decoder ()
emptyDecoder (\() model
m DOMRef
ref -> model -> DOMRef -> action
action model
m DOMRef
ref)
onLoadWith :: (DOMRef -> action) -> Attribute model action
onLoadWith :: forall action model. (DOMRef -> action) -> Attribute model action
onLoadWith DOMRef -> action
action = MisoString
-> Decoder ()
-> (() -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"load" Decoder ()
emptyDecoder (\() model
_ DOMRef
ref -> DOMRef -> action
action DOMRef
ref)