How to pause for a measured time in Elm? -


i attempting create simple web page using elm involves displaying image measured amount of time, such second or millisecond.

is there way "pause" in elm? display, pause, , remove image achieve effect.

i noticed clock example appears update every time machine's clock triggers new second, whereas looking can pause update set time (such fraction of second) after starting time.

you can create new msg value triggers url (of image) changes. , create subscription via timer.every. can add flag in model indicate whether keep updating image or not, if that's want.

example:

subscriptions : model -> sub msg subscriptions model =     if model.keepupdating         time.every (3 * second) (\x -> updateimage)     else         sub.none   update : msg -> model -> ( model, cmd msg ) update msg model =     case msg of         updateimage ->             ( { model | image_url = "http://to_new_image/..." }, cmd.none ) 

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -