{"id":16608405,"url":"https://github.com/curve/ereignis","last_synced_at":"2025-03-21T14:30:54.922Z","repository":{"id":64004858,"uuid":"532453143","full_name":"Curve/ereignis","owner":"Curve","description":"🎉 A thread-safe C++20 Event Library","archived":false,"fork":false,"pushed_at":"2024-09-23T22:07:33.000Z","size":87,"stargazers_count":14,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T02:02:59.557Z","etag":null,"topics":["cmake","cpp","cpp-library","cpp20","cpp20-library","events"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Curve.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":"2022-09-04T06:04:19.000Z","updated_at":"2025-03-05T21:58:17.000Z","dependencies_parsed_at":"2023-01-14T18:30:39.649Z","dependency_job_id":"8377e756-b5be-4f6c-869d-13bbfcced373","html_url":"https://github.com/Curve/ereignis","commit_stats":null,"previous_names":["curve/ereignis","soundux/ereignis"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Curve%2Fereignis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Curve%2Fereignis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Curve%2Fereignis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Curve%2Fereignis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Curve","download_url":"https://codeload.github.com/Curve/ereignis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244815091,"owners_count":20514884,"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":["cmake","cpp","cpp-library","cpp20","cpp20-library","events"],"created_at":"2024-10-12T01:26:05.829Z","updated_at":"2025-03-21T14:30:54.625Z","avatar_url":"https://github.com/Curve.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cdiv align=\"center\"\u003e \n    \u003cimg src=\"assets/logo.png\" height=312\u003e\n\u003c/div\u003e\n\n\u003cbr/\u003e\n\n\u003cp align=\"center\"\u003e\n    A thread-safe C++20 Event Library\n\u003c/p\u003e\n\n\u003chr/\u003e\n\n## 📖 Description\n\n_Ereignis_ is a library that implements an easy to use Event/Callback mechanism that allows for lazy-evaluation of the the results returned by `fire`.\n\n## 📦 Installation\n\n\u003e [!NOTE]  \n\u003e This library requires a C++20 capable compiler.\n\u003e See versions `\u003c 2.0` for C++17 support.\n\n* Using [CPM](https://github.com/cpm-cmake/CPM.cmake)\n  ```cmake\n  CPMFindPackage(\n    NAME           ereignis\n    VERSION        4.0\n    GIT_REPOSITORY \"https://github.com/Curve/ereignis\"\n  )\n  ```\n\n* Using FetchContent\n  ```cmake\n  include(FetchContent)\n\n  FetchContent_Declare(ereignis GIT_REPOSITORY \"https://github.com/Curve/ereignis\" GIT_TAG v4.0)\n  FetchContent_MakeAvailable(ereignis)\n\n  target_link_libraries(\u003ctarget\u003e cr::ereignis)\n  ```\n\n## 📃 Usage\n\n* Basic callback\n\n  ```cpp\n  #include \u003cereignis/manager.hpp\u003e\n\n  using ereignis::event;\n\n  ereignis::manager\u003c\n    event\u003c0, void(int)\u003e\n  \u003e manager;\n\n  manager.at\u003c0\u003e().add([](int i) { std::cout \u003c\u003c i \u003c\u003c std::endl; });\n  manager.at\u003c0\u003e().fire(1337);\n  ```\n\n* Result iteration\n\n  ```cpp\n  #include \u003cereignis/manager.hpp\u003e\n\n  enum class window_event\n  {\n    close\n  };\n\n  using ereignis::event;\n\n  ereignis::manager\u003c\n    event\u003cwindow_event::close, bool()\u003e\n  \u003e manager;\n\n  manager.at\u003cwindow_event::close\u003e().add([]() -\u003e bool { return true; });\n  \n  manager.at\u003cwindow_event::close\u003e().add([]() -\u003e bool \n  { \n    std::cout \u003c\u003c \"Reached!\" \u003c\u003c std::endl; \n    return false; \n  });\n\n  // Lets fire all callbacks until we get `true`.\n\n  for (const auto\u0026 result : manager.at\u003cwindow_event::close\u003e().fire())\n  {\n    if (result)\n    {\n      return;\n    }\n  }\n\n  // 'Reached!' will never be printed.\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurve%2Fereignis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcurve%2Fereignis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurve%2Fereignis/lists"}