{"id":22840827,"url":"https://github.com/rustunit/bevy_channel_trigger","last_synced_at":"2025-04-28T10:50:14.191Z","repository":{"id":260926471,"uuid":"849855493","full_name":"rustunit/bevy_channel_trigger","owner":"rustunit","description":"Send events via a channels form anywhere (eg. web-dom, c-ffi) to Bevy Observers","archived":false,"fork":false,"pushed_at":"2024-11-30T23:07:48.000Z","size":295,"stargazers_count":18,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-10T11:53:48.041Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rustunit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","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},"funding":{"github":"rustunit"}},"created_at":"2024-08-30T11:39:29.000Z","updated_at":"2024-12-06T03:00:33.000Z","dependencies_parsed_at":"2024-11-03T17:32:32.940Z","dependency_job_id":null,"html_url":"https://github.com/rustunit/bevy_channel_trigger","commit_stats":null,"previous_names":["rustunit/bevy_channel_trigger"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustunit%2Fbevy_channel_trigger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustunit%2Fbevy_channel_trigger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustunit%2Fbevy_channel_trigger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustunit%2Fbevy_channel_trigger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rustunit","download_url":"https://codeload.github.com/rustunit/bevy_channel_trigger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229057609,"owners_count":18013289,"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":[],"created_at":"2024-12-13T01:13:34.038Z","updated_at":"2025-04-28T10:50:14.177Z","avatar_url":"https://github.com/rustunit.png","language":"Rust","funding_links":["https://github.com/sponsors/rustunit"],"categories":[],"sub_categories":[],"readme":"# bevy_channel_trigger\n\n[![Following released Bevy versions](https://img.shields.io/badge/Bevy%20tracking-released%20version-lightblue)](https://bevyengine.org/learn/quick-start/plugin-development/#main-branch-tracking)\n[![crates.io](https://img.shields.io/crates/v/bevy_channel_trigger)](https://crates.io/crates/bevy_channel_trigger)\n[![docs.rs](https://docs.rs/bevy_channel_trigger/badge.svg)](https://docs.rs/bevy_channel_trigger)\n\nSend events via a channel from anywhere (eg. web-dom, c-ffi) to Bevy Observers.\nInspired by [bevy_crossbeam_event](https://github.com/johanhelsing/bevy_crossbeam_event) but delivering the events via Bevy Observers instead of `EventReader`.\n\n![schema](schema.png)\n\n# example\n\n```rust\n#[derive(Event)]\nstruct MyEvent(i32);\n\nfn main() {\n    use bevy_channel_trigger::ChannelTriggerApp;\n\n    let mut app = App::new();\n    app.add_plugins(MinimalPlugins);\n\n    // create channel\n    let sender = app.add_channel_trigger::\u003cMyEvent\u003e();\n\n    // use sender from anywhere:\n    thread::spawn(move || {\n        let mut counter = 1;\n        loop {\n            // send events back to bevy\n            sender.send(MyEvent(counter));\n            thread::sleep(Duration::from_secs(1));\n            counter += 1;\n        }\n    });\n\n    // register an observer to receive the events sent via `sender`\n    app.observe(on_event);\n\n    app.run();\n}\n\n// regular bevy observer to handle these events coming into the bevy world\nfn on_event(trigger: Trigger\u003cMyEvent\u003e) {\n    let event = trigger.event();\n    println!(\"trigger with: {}\", event.0);\n}\n```\n\n# Other examples\n\n* [bevy_web_drop_image_as_sprite](https://github.com/rustunit/bevy_web_drop_image_as_sprite)\n\n## Our Other Crates\n\n- [bevy_debug_log](https://github.com/rustunit/bevy_debug_log)\n- [bevy_device_lang](https://github.com/rustunit/bevy_device_lang)\n- [bevy_web_popups](https://github.com/rustunit/bevy_web_popups)\n- [bevy_libgdx_atlas](https://github.com/rustunit/bevy_libgdx_atlas)\n- [bevy_ios_iap](https://github.com/rustunit/bevy_ios_iap)\n- [bevy_ios_review](https://github.com/rustunit/bevy_ios_review)\n- [bevy_ios_gamecenter](https://github.com/rustunit/bevy_ios_gamecenter)\n- [bevy_ios_alerts](https://github.com/rustunit/bevy_ios_alerts)\n- [bevy_ios_notifications](https://github.com/rustunit/bevy_ios_notifications)\n- [bevy_ios_impact](https://github.com/rustunit/bevy_ios_impact)\n- [bevy_ios_safearea](https://github.com/rustunit/bevy_ios_safearea)\n\n## Compatible Bevy Versions\n\n|bevy|our version|\n|-|-|\n|0.16|0.4,main|\n|0.15|0.3|\n|0.14|0.1,0.2|\n\n## License\n\nthis crate is dual-licensed under either [MIT](https://opensource.org/license/MIT) or [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0), at your option.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustunit%2Fbevy_channel_trigger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frustunit%2Fbevy_channel_trigger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustunit%2Fbevy_channel_trigger/lists"}