Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (27 sloc) 0.839 kb
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS -Wall -fno-warn-name-shadowing #-}
module Index where
import Language.Fay.FFI
import Language.Fay.Prelude
import Application.SharedTypes
import Dom
main :: Fay ()
main = addOnload onload
onload :: Fay ()
onload = do
contents <- byId "content"
div <- createElement "div"
setInnerHtml div "This element was created by Fay through an onload handler!"
appendChild contents div
currentTime
button <- byId "current-time-button"
addEvent button "click" (const currentTime)
return ()
currentTime :: Fay ()
currentTime = do
ajaxJson "/ajax/current-time" $ \(CTR time) -> do
el <- byId "current-time"
setInnerHtml el time
ajaxJson :: Foreign a => String -> (a -> Fay ()) -> Fay ()
ajaxJson = ffi "jQuery.ajax(%1, { success : %2 })"
Jump to Line
Something went wrong with that request. Please try again.