{"id":24092947,"url":"https://github.com/lukasmlady/elm-broadcast-channel","last_synced_at":"2025-08-12T14:33:25.448Z","repository":{"id":89060876,"uuid":"87620771","full_name":"lukasmlady/elm-broadcast-channel","owner":"lukasmlady","description":"Communicate across browsing contexts (windows, tabs, frames, or iframes) with the same origin in Elm","archived":false,"fork":false,"pushed_at":"2017-04-08T17:43:11.000Z","size":5,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-27T10:58:53.129Z","etag":null,"topics":["broadcasting","elm"],"latest_commit_sha":null,"homepage":null,"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/lukasmlady.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-08T08:48:48.000Z","updated_at":"2018-02-01T03:25:11.000Z","dependencies_parsed_at":"2023-06-13T18:30:21.971Z","dependency_job_id":null,"html_url":"https://github.com/lukasmlady/elm-broadcast-channel","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lukasmlady/elm-broadcast-channel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasmlady%2Felm-broadcast-channel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasmlady%2Felm-broadcast-channel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasmlady%2Felm-broadcast-channel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasmlady%2Felm-broadcast-channel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukasmlady","download_url":"https://codeload.github.com/lukasmlady/elm-broadcast-channel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasmlady%2Felm-broadcast-channel/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270076551,"owners_count":24522950,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["broadcasting","elm"],"created_at":"2025-01-10T08:53:17.831Z","updated_at":"2025-08-12T14:33:25.441Z","avatar_url":"https://github.com/lukasmlady.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BroadcastChannel\n\nCommunicate across browsing contexts (windows, tabs, frames, iframes, or workers) with the same origin.\n\nSee [Can I Use](http://caniuse.com/#feat=broadcastchannel) for browser support.\n\n## Usage\n\n`BroadcastChannel` exposes two function:\n\n- `listen` for creating subscriptions\n- `send` for creating commands\n\n### Broadcasting a message\n\nUse `BroadcastChannel.send \"test_channel\" \"my message!\"` to create a send command.\n\n### Subscribing to a channel\n\nUse `BroadcastChannel.listen \"test_channel\" NewMessage` to create a channel subscription.\n\n## Example\n\n```elm\nimport Html exposing (..)\nimport Html.Attributes exposing (..)\nimport Html.Events exposing (..)\nimport BroadcastChannel\n\n\nmain =\n    Html.program\n        { init = init\n        , view = view\n        , update = update\n        , subscriptions = subscriptions\n        }\n\n\n\n-- MODEL\n\n\ntype alias Model =\n    { input : String\n    , messages : List String\n    }\n\n\ninit : ( Model, Cmd Msg )\ninit =\n    ( Model \"\" [], Cmd.none )\n\n\n\n-- UPDATE\n\n\ntype Msg\n    = Input String\n    | Send\n    | NewMessage String\n\n\nupdate : Msg -\u003e Model -\u003e ( Model, Cmd Msg )\nupdate msg { input, messages } =\n    case msg of\n        Input newInput -\u003e\n            ( Model newInput messages, Cmd.none )\n\n        Send -\u003e\n            ( Model \"\" messages, BroadcastChannel.send \"test_channel\" input )\n\n        NewMessage str -\u003e\n            ( Model input (str :: messages), Cmd.none )\n\n\n\n-- SUBSCRIPTIONS\n\n\nsubscriptions : Model -\u003e Sub Msg\nsubscriptions model =\n    BroadcastChannel.listen \"test_channel\" NewMessage\n\n\n\n-- VIEW\n\n\nview : Model -\u003e Html Msg\nview model =\n    div []\n        [ h2 [] [ text \"Broadcast a message to other browsing contexts:\" ]\n        , input [ onInput Input, value model.input ] [ text \"-\" ]\n        , button [ onClick Send ] [ text \"Send\" ]\n        , ul [] (List.map (\\item -\u003e li [] [ text item ]) model.messages)\n        ]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukasmlady%2Felm-broadcast-channel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukasmlady%2Felm-broadcast-channel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukasmlady%2Felm-broadcast-channel/lists"}