Shpadoinkle-html-0.0.0.1: A typed, template generated Html DSL, and helpers.

Safe HaskellNone
LanguageHaskell2010

Shpadoinkle.Html.Event

Description

This module provides a DSL of Events found on HTML elements. This DSL is entirely optional. You may use the Props PListener constructor provided by Shpadoinkle core and completely ignore this module. You can use the listener, listen, listenRaw, listen' convenience functions as well, without using this module. But for those who like a typed DSL with named function, and overloading, this is for you.

All listners come in 2 flavors. Unctuous flavors. Plain (IE onInput), and prime (IE onInput'). The following should hold

  onX (pure x) = onX' x

A flavor providing access to the RawNode and the RawEvent are not provided here. If you want access to these try the listenRaw constructor. The intent of this DSL is to provide a simple named functions.

Right now this module features limited specialization. But ideally we specialize all of these listeners. For example the onInput listener takes a function (Text -> m a) where Text is the current value of the input, and onKeyup takes a function of type (KeyCode -> m a) from Keyboard. Mouse move listeners for example, should take a function of ((Float, Float) -> m a) but this work is not yet done. See https://gitlab.com/fresheyeball/Shpadoinkle/issues/5

Documentation

onInput' :: MonadJSM m => (Text -> m a) -> (Text, Prop m a) Source #

onInput :: MonadJSM m => (Text -> a) -> (Text, Prop m a) Source #

mkOnKey :: MonadJSM m => Text -> (KeyCode -> m a) -> (Text, Prop m a) Source #

onKeyup :: MonadJSM m => (KeyCode -> m a) -> (Text, Prop m a) Source #

onKeydown :: MonadJSM m => (KeyCode -> m a) -> (Text, Prop m a) Source #

onKeypress :: MonadJSM m => (KeyCode -> m a) -> (Text, Prop m a) Source #

onKeyup' :: MonadJSM m => (KeyCode -> a) -> (Text, Prop m a) Source #

onKeydown' :: MonadJSM m => (KeyCode -> a) -> (Text, Prop m a) Source #

onKeypress' :: MonadJSM m => (KeyCode -> a) -> (Text, Prop m a) Source #

onCheck' :: MonadJSM m => (Bool -> m a) -> (Text, Prop m a) Source #

onCheck :: MonadJSM m => (Bool -> a) -> (Text, Prop m a) Source #

onSubmit' :: MonadJSM m => m a -> (Text, Prop m a) Source #

onSubmit :: MonadJSM m => a -> (Text, Prop m a) Source #

mkGlobalKey :: Text -> (KeyCode -> JSM ()) -> JSM () Source #

globalKeyDown :: (KeyCode -> JSM ()) -> JSM () Source #

globalKeyUp :: (KeyCode -> JSM ()) -> JSM () Source #

onTouchstart' :: m a -> (Text, Prop m a) Source #

onTouchmove :: Applicative m => a -> (Text, Prop m a) Source #

onTouchmove' :: m a -> (Text, Prop m a) Source #

onTouchend :: Applicative m => a -> (Text, Prop m a) Source #

onTouchend' :: m a -> (Text, Prop m a) Source #

onTouchcancel' :: m a -> (Text, Prop m a) Source #

onWheel :: Applicative m => a -> (Text, Prop m a) Source #

onWheel' :: m a -> (Text, Prop m a) Source #

onToggle :: Applicative m => a -> (Text, Prop m a) Source #

onToggle' :: m a -> (Text, Prop m a) Source #

onStorage :: Applicative m => a -> (Text, Prop m a) Source #

onStorage' :: m a -> (Text, Prop m a) Source #

onShow :: Applicative m => a -> (Text, Prop m a) Source #

onShow' :: m a -> (Text, Prop m a) Source #

onPopstate :: Applicative m => a -> (Text, Prop m a) Source #

onPopstate' :: m a -> (Text, Prop m a) Source #

onOffline :: Applicative m => a -> (Text, Prop m a) Source #

onOffline' :: m a -> (Text, Prop m a) Source #

onOnline :: Applicative m => a -> (Text, Prop m a) Source #

onOnline' :: m a -> (Text, Prop m a) Source #

onMousewheel' :: m a -> (Text, Prop m a) Source #

onOpen :: Applicative m => a -> (Text, Prop m a) Source #

onOpen' :: m a -> (Text, Prop m a) Source #

onMessage :: Applicative m => a -> (Text, Prop m a) Source #

onMessage' :: m a -> (Text, Prop m a) Source #

onAnimationend' :: m a -> (Text, Prop m a) Source #

onWaiting :: Applicative m => a -> (Text, Prop m a) Source #

onWaiting' :: m a -> (Text, Prop m a) Source #

onVolumechange' :: m a -> (Text, Prop m a) Source #

onTimeupdate' :: m a -> (Text, Prop m a) Source #

onSuspend :: Applicative m => a -> (Text, Prop m a) Source #

onSuspend' :: m a -> (Text, Prop m a) Source #

onStalled :: Applicative m => a -> (Text, Prop m a) Source #

onStalled' :: m a -> (Text, Prop m a) Source #

onSeeking :: Applicative m => a -> (Text, Prop m a) Source #

onSeeking' :: m a -> (Text, Prop m a) Source #

onSeeked :: Applicative m => a -> (Text, Prop m a) Source #

onSeeked' :: m a -> (Text, Prop m a) Source #

onRatechange' :: m a -> (Text, Prop m a) Source #

onProgress :: Applicative m => a -> (Text, Prop m a) Source #

onProgress' :: m a -> (Text, Prop m a) Source #

onPlaying :: Applicative m => a -> (Text, Prop m a) Source #

onPlaying' :: m a -> (Text, Prop m a) Source #

onPlay :: Applicative m => a -> (Text, Prop m a) Source #

onPlay' :: m a -> (Text, Prop m a) Source #

onPause :: Applicative m => a -> (Text, Prop m a) Source #

onPause' :: m a -> (Text, Prop m a) Source #

onLoadstart :: Applicative m => a -> (Text, Prop m a) Source #

onLoadstart' :: m a -> (Text, Prop m a) Source #

onLoadeddata' :: m a -> (Text, Prop m a) Source #

onEnded :: Applicative m => a -> (Text, Prop m a) Source #

onEnded' :: m a -> (Text, Prop m a) Source #

onEmptied :: Applicative m => a -> (Text, Prop m a) Source #

onEmptied' :: m a -> (Text, Prop m a) Source #

onCanplay :: Applicative m => a -> (Text, Prop m a) Source #

onCanplay' :: m a -> (Text, Prop m a) Source #

onAbort :: Applicative m => a -> (Text, Prop m a) Source #

onAbort' :: m a -> (Text, Prop m a) Source #

onBeforeprint' :: m a -> (Text, Prop m a) Source #

onAfterprint' :: m a -> (Text, Prop m a) Source #

onPaste :: Applicative m => a -> (Text, Prop m a) Source #

onPaste' :: m a -> (Text, Prop m a) Source #

onCut :: Applicative m => a -> (Text, Prop m a) Source #

onCut' :: m a -> (Text, Prop m a) Source #

onCopy :: Applicative m => a -> (Text, Prop m a) Source #

onCopy' :: m a -> (Text, Prop m a) Source #

onDrop :: Applicative m => a -> (Text, Prop m a) Source #

onDrop' :: m a -> (Text, Prop m a) Source #

onDragstart :: Applicative m => a -> (Text, Prop m a) Source #

onDragstart' :: m a -> (Text, Prop m a) Source #

onDragover :: Applicative m => a -> (Text, Prop m a) Source #

onDragover' :: m a -> (Text, Prop m a) Source #

onDragleave :: Applicative m => a -> (Text, Prop m a) Source #

onDragleave' :: m a -> (Text, Prop m a) Source #

onDragenter :: Applicative m => a -> (Text, Prop m a) Source #

onDragenter' :: m a -> (Text, Prop m a) Source #

onDragend :: Applicative m => a -> (Text, Prop m a) Source #

onDragend' :: m a -> (Text, Prop m a) Source #

onDrag :: Applicative m => a -> (Text, Prop m a) Source #

onDrag' :: m a -> (Text, Prop m a) Source #

onSelect :: Applicative m => a -> (Text, Prop m a) Source #

onSelect' :: m a -> (Text, Prop m a) Source #

onSearch :: Applicative m => a -> (Text, Prop m a) Source #

onSearch' :: m a -> (Text, Prop m a) Source #

onReset :: Applicative m => a -> (Text, Prop m a) Source #

onReset' :: m a -> (Text, Prop m a) Source #

onInvalid :: Applicative m => a -> (Text, Prop m a) Source #

onInvalid' :: m a -> (Text, Prop m a) Source #

onFocusout :: Applicative m => a -> (Text, Prop m a) Source #

onFocusout' :: m a -> (Text, Prop m a) Source #

onFocusin :: Applicative m => a -> (Text, Prop m a) Source #

onFocusin' :: m a -> (Text, Prop m a) Source #

onFocus :: Applicative m => a -> (Text, Prop m a) Source #

onFocus' :: m a -> (Text, Prop m a) Source #

onChange :: Applicative m => a -> (Text, Prop m a) Source #

onChange' :: m a -> (Text, Prop m a) Source #

onBlur :: Applicative m => a -> (Text, Prop m a) Source #

onBlur' :: m a -> (Text, Prop m a) Source #

onUnload :: Applicative m => a -> (Text, Prop m a) Source #

onUnload' :: m a -> (Text, Prop m a) Source #

onScroll :: Applicative m => a -> (Text, Prop m a) Source #

onScroll' :: m a -> (Text, Prop m a) Source #

onResize :: Applicative m => a -> (Text, Prop m a) Source #

onResize' :: m a -> (Text, Prop m a) Source #

onPagehide :: Applicative m => a -> (Text, Prop m a) Source #

onPagehide' :: m a -> (Text, Prop m a) Source #

onPageshow :: Applicative m => a -> (Text, Prop m a) Source #

onPageshow' :: m a -> (Text, Prop m a) Source #

onLoad :: Applicative m => a -> (Text, Prop m a) Source #

onLoad' :: m a -> (Text, Prop m a) Source #

onHashchange' :: m a -> (Text, Prop m a) Source #

onError :: Applicative m => a -> (Text, Prop m a) Source #

onError' :: m a -> (Text, Prop m a) Source #

onBeforeunload' :: m a -> (Text, Prop m a) Source #

onMouseup :: Applicative m => a -> (Text, Prop m a) Source #

onMouseup' :: m a -> (Text, Prop m a) Source #

onMouseout :: Applicative m => a -> (Text, Prop m a) Source #

onMouseout' :: m a -> (Text, Prop m a) Source #

onMouseover :: Applicative m => a -> (Text, Prop m a) Source #

onMouseover' :: m a -> (Text, Prop m a) Source #

onMousemove :: Applicative m => a -> (Text, Prop m a) Source #

onMousemove' :: m a -> (Text, Prop m a) Source #

onMouseleave' :: m a -> (Text, Prop m a) Source #

onMousedown :: Applicative m => a -> (Text, Prop m a) Source #

onMousedown' :: m a -> (Text, Prop m a) Source #

onDblclick :: Applicative m => a -> (Text, Prop m a) Source #

onDblclick' :: m a -> (Text, Prop m a) Source #

onContextmenu' :: m a -> (Text, Prop m a) Source #

onClick :: Applicative m => a -> (Text, Prop m a) Source #

onClick' :: m a -> (Text, Prop m a) Source #