{"id":17281510,"url":"https://github.com/sumory/mas","last_synced_at":"2026-05-09T14:41:24.798Z","repository":{"id":145420886,"uuid":"175985970","full_name":"sumory/mas","owner":"sumory","description":"a state management library.","archived":false,"fork":false,"pushed_at":"2019-03-16T14:58:47.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-31T16:56:06.891Z","etag":null,"topics":["actions","pubsub","redux","state-management"],"latest_commit_sha":null,"homepage":null,"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/sumory.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":"2019-03-16T14:58:27.000Z","updated_at":"2019-10-08T18:45:43.000Z","dependencies_parsed_at":"2024-03-13T02:47:06.664Z","dependency_job_id":null,"html_url":"https://github.com/sumory/mas","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sumory%2Fmas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sumory%2Fmas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sumory%2Fmas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sumory%2Fmas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sumory","download_url":"https://codeload.github.com/sumory/mas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245679648,"owners_count":20654873,"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":["actions","pubsub","redux","state-management"],"created_at":"2024-10-15T09:46:03.556Z","updated_at":"2026-05-09T14:41:19.764Z","avatar_url":"https://github.com/sumory.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Mas\n\na C++ port of [redux](https://redux.js.org/) library with some custom features.\n\n```c++\n#include \u003cmas/store.h\u003e\n\nstruct State {\n    int id = 1;\n};\n\nstruct Action {\n    std::string event;\n};\n\nauto reducer = [](const State\u0026 state, const Action\u0026 action) -\u003e State {\n    State new_state = state;\n    if (action.event == \"add\") {\n        new_state.id++;\n    } else if (action.event == \"subtract\") {\n        new_state.id--;\n    }\n    return new_state;\n};\n\nint main(int argc, char** argv) {\n    using mas::SimpleStore;\n\n    State s;\n    SimpleStore\u003cState, Action\u003e store(s, reducer);\n    store.subscribe(\"add\", [](const State\u0026 s) {\n        std::cout \u003c\u003c \"receiver 1, receive add event\" \u003c\u003c std::endl;\n        return 0;\n    });\n    store.subscribe(\"add\", [](const State\u0026 s) {\n        std::cout \u003c\u003c \"receiver 2, receive add event\" \u003c\u003c std::endl;\n        return 0;\n    });\n    store.subscribe(\"subtract\", [](const State\u0026 s) {\n        std::cout \u003c\u003c \"receiver 3, receive subtract event\" \u003c\u003c std::endl;\n        return 0;\n    });\n\n    Action action;\n    {\n        action.event = \"add\";\n        store.dispatch(action, \"add\");\n        auto\u0026 state = store.state();\n        std::cout \u003c\u003c \"state id:\" \u003c\u003c state.id \u003c\u003c std::endl;\n    }\n    {\n        action.event = \"subtract\";\n        store.dispatch(action, [](const Action\u0026 a) { return a.event; });\n        auto\u0026 state = store.state();\n        std::cout \u003c\u003c \"state id:\" \u003c\u003c state.id \u003c\u003c std::endl;\n    }\n    \n    return 0;\n}\n\n```\n\n### License\n\n[MIT](./LICENSE) License","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsumory%2Fmas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsumory%2Fmas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsumory%2Fmas/lists"}