How to use setTimeout in PureScript v0.7 -
i want use settimeout animation in purescript this.
loop n = if n > 100 return unit else print n timeout (loop n+1) 30
purescript-timers no longer work in v0.7.
i don't have slightest idea how implement this.
there 2 ways:
use purescript-js-timers purescript-contrib.
use purescript-aff (
later'
).
i prefer later, , here example:
import control.monad.aff aff update :: forall eff. action -> state -> effmodel state action (eff) update myaction mystate = { state: mystate, effects: [ aff.later' 1000 $ pure myotheraction ] }
Comments
Post a Comment