更新: ghcjs中存在一个问题:https://github.com/ghcjs/ghcjs/issues/296
我玩ghcjs和钠但3秒后我的应用程序不再发出事件.
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Applicative ((<$>))
import Control.Concurrent (forkIO, threadDelay)
import Control.Monad (forever)
import Data.Default (def)
import Data.Text (Text, pack)
import FRP.Sodium
import JavaScript.JQuery hiding (Event)
main :: IO ()
main = do
body <- select "body"
-- a button
(btn, btnE) <- mkBtnE "Click"
appendJQuery btn body
-- a behavior: counter - increment when btnE (button event) arrive
counterB <- sync …Run Code Online (Sandbox Code Playgroud)