WebFudgets-0.1.0.1: Web Fudgets is a prototype library for writing web application in a functional style in Haskell.

MaintainerThomas Hallgren
StabilityExperimental
Safe HaskellNone
LanguageHaskell2010

HasteExtras

Contents

Description

Haste Extras for WebFudgets

Synopsis

Creating specific elements

imgElem :: MonadIO m => AttrValue -> m Elem

<img src="url">

canvasElem :: MonadIO m => (Int, Int) -> m Elem

canvasElem' :: MonadIO m => Int -> (Int, Int) -> m Elem

Use canvasElem' devicePixelRatio to make things look good on high resolution screens

Screen resolution

devicePixelRatio :: Int

window.devicePixelRatio (shouldn't really be a constant, since it might change if the users zooms)

Element properties

select :: MonadIO m => Elem -> m ()

Makes the text in an element selected (without moving the focus to the element)

setChecked :: MonadIO m => Elem -> Bool -> m ()

Set the boolean checked property of an element (useful for <input type="checkbox"> elements)

getChecked :: MonadIO m => Elem -> m Bool

Get the boolean checked property of an element (useful for <input type="checkbox"> elements)

setBool :: MonadIO m => Elem -> PropID -> Bool -> m ()

Set a boolean property of an element (e.g. "checked" and "disabled")

getBool :: MonadIO m => Elem -> PropID -> m Bool

Get a boolean property of an element (e.g. "checked" and "disabled")

setValue :: (IsElem e, MonadIO m) => e -> String -> m ()

Set the "value" property

Things for the document head

documentHead :: Elem

Reference to the document's <head> element, analogous to documentBody

addStyleLink :: MonadIO m => AttrValue -> m ()

Add a link to a style sheet to the document head, <link rel="stylesheet" type="text/css" href="url">

metaViewport :: IO Elem

<meta name="viewport" content="width=device-width">

addMetaViewport :: IO ()

Add metaViewport to the document head. Usually good for mobile browsers, no effect on desktop browsers.

Wrapping tags around elements

wrap1 :: (IsElem child, MonadIO m) => String -> child -> m Elem

wrap :: (Foldable t, IsElem child, MonadIO m) => String -> t child -> m Elem

wrap "tag" children = <tag>children</tag>

wrap' :: (Foldable t, IsElem child, MonadIO m) => String -> [Attribute] -> t child -> m Elem

cls :: (IsElem e, MonadIO m) => m e -> AttrValue -> m e

Ajax