{"id":16710574,"url":"https://github.com/andrewmacmurray/elm-delay","last_synced_at":"2025-03-21T20:33:10.473Z","repository":{"id":47428854,"uuid":"90529084","full_name":"andrewMacmurray/elm-delay","owner":"andrewMacmurray","description":"Utilities to delay updates after a set period of time","archived":false,"fork":false,"pushed_at":"2023-01-07T23:26:47.000Z","size":1391,"stargazers_count":28,"open_issues_count":11,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-13T20:08:56.049Z","etag":null,"topics":["delay","elm","sequence","settimeout"],"latest_commit_sha":null,"homepage":"http://package.elm-lang.org/packages/andrewMacmurray/elm-delay/latest","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrewMacmurray.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-07T11:50:17.000Z","updated_at":"2022-08-27T16:49:42.000Z","dependencies_parsed_at":"2023-02-08T03:30:45.817Z","dependency_job_id":null,"html_url":"https://github.com/andrewMacmurray/elm-delay","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewMacmurray%2Felm-delay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewMacmurray%2Felm-delay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewMacmurray%2Felm-delay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewMacmurray%2Felm-delay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewMacmurray","download_url":"https://codeload.github.com/andrewMacmurray/elm-delay/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221818578,"owners_count":16885777,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["delay","elm","sequence","settimeout"],"created_at":"2024-10-12T20:08:58.650Z","updated_at":"2024-10-28T10:47:36.563Z","avatar_url":"https://github.com/andrewMacmurray.png","language":"Elm","readme":"# Elm Delay\n\nElm utilities to trigger updates after a delay\n\n**example**: https://elm-delay-examples.surge.sh/\n\n### Why?\n\nSometimes you need to trigger updates after a period of time (i.e. to wait for a css transition or animation to complete) or maybe you need to chain a sequence of these updates (for more complex states).\n\nThis library provides utilities to express this more tidily.\n\n### How?\n\n#### Send a single delayed `Msg`\n\nTo trigger a single update after a period of time pass `Delay.after` as a command to the elm runtime:\n\n```elm\nFirstMessage -\u003e\n    ( model\n    , Delay.after 500 SecondMessage\n    )\n```\n\nAfter triggering `FirstMessage`, `500ms` later update will be called with `SecondMessage`\n\n#### Send a sequence of delayed `Msg`s\n\n```elm\nTrigger -\u003e\n    ( model\n    , Delay.sequence\n        [ ( 1000, FirstMessage )\n        , ( 2000, SecondMessage )\n        , ( 1000, ThirdMessage )\n        ]\n    )\n```\n\nby sending a `Trigger` `Msg`:\n\n- after `1000ms` update will be called with `FirstMessage`\n- then after `2000ms` update will be called with `SecondMessage`\n- then after `1000ms` update will be called with `ThirdMessage`\n\nAs a convenience if you'd only like to start a sequence if the model is in a particular shape you can use `Delay.sequenceIf`\n\n```elm\nTrigger -\u003e\n    ( model\n    , Delay.sequenceIf (not model.updating)\n        [ ( 1000, FirstMessage )\n        , ( 2000, SecondMessage )\n        , ( 1000, ThirdMessage )\n        ]\n    )\n```\n\nIf you'd like all the steps to have the same unit of time, use the `Delay.withUnit` helper\n\n```elm\nTrigger -\u003e\n    ( model\n    , Delay.sequence \n        Delay.withUnit Delay.seconds\n            [ ( 1, FirstMessage )\n            , ( 2, SecondMessage )\n            , ( 1, ThirdMessage )\n            ]\n    )\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewmacmurray%2Felm-delay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewmacmurray%2Felm-delay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewmacmurray%2Felm-delay/lists"}