【发布时间】:2019-03-10 01:01:58
【问题描述】:
我想在 purescript 中获取 keydown 事件,所以我使用了 DomEvent。 这是我的代码。
main :: Eff (HA.HalogenEffects (console :: CONSOLE, timer :: T.TIMER)) Unit
main = HA.runHalogenAff do
body <- HA.awaitBody
cube <- runUI C.cubes unit body
documenttarget <- liftEff $ window >>= document <#> DHT.htmlDocumentToEventTarget
addEventListener (EventType "keydown") (eventListener test) true (documenttarget)
H.liftEff $ T.setInterval (1000 / frameRate) do
HA.runHalogenAff $ cube.query $ H.action C.Tick
当我尝试运行此代码时,我收到这样的错误。
documenttarget <- liftEff $ window >>= document <#> DHT.htmlDocumentToEventTarget
Coudn't match type Eff with type Aff
我知道 aff 和 eff,但我是 purescript 的新手,所以我不确定我必须做些什么来解决这个问题。 我能做什么?
【问题讨论】:
标签: purescript purescript-halogen