{"id":17790357,"url":"https://github.com/mowtwo/mow-reactive","last_synced_at":"2026-04-09T02:31:33.899Z","repository":{"id":112292627,"uuid":"481524447","full_name":"mowtwo/mow-reactive","owner":"mowtwo","description":"一个针对响应式编程的简单实现","archived":false,"fork":false,"pushed_at":"2022-04-14T09:14:06.000Z","size":9,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-16T07:57:55.716Z","etag":null,"topics":["react","reative","solidjs","typescript","vue"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mowtwo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-04-14T08:22:57.000Z","updated_at":"2022-08-03T09:55:42.000Z","dependencies_parsed_at":"2023-05-12T12:45:38.843Z","dependency_job_id":null,"html_url":"https://github.com/mowtwo/mow-reactive","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mowtwo/mow-reactive","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mowtwo%2Fmow-reactive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mowtwo%2Fmow-reactive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mowtwo%2Fmow-reactive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mowtwo%2Fmow-reactive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mowtwo","download_url":"https://codeload.github.com/mowtwo/mow-reactive/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mowtwo%2Fmow-reactive/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31582603,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"online","status_checked_at":"2026-04-09T02:00:06.848Z","response_time":112,"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":["react","reative","solidjs","typescript","vue"],"created_at":"2024-10-27T10:42:19.264Z","updated_at":"2026-04-09T02:31:33.871Z","avatar_url":"https://github.com/mowtwo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 一个针对响应式编程的简单实现\n\n## 从Vue中获取的灵感\n在进行mini-vue的开发学习后，对于reactive数据跟effect绑定的实现基本已经通透，复杂的功能背后其实一般都是依赖于更基础的实现。因此特别写下这个最小版本的reactive功能，以此提供一个给其他想了解的新手一个参考过程。\n\n## 从简实现\n由于Vue中实现大都是考虑到更自动化，并且有对于数据的一个递归监听，因此多出了很多看起来不好理解的代码，但是实际上将这些代码简化，剩余核心实现（并不是说只有这部分最重要，而是大部分的实现都是依赖于此）代码不过堪堪几十行。  \n虽然最终完成的代码量很低，但是其实基本上做到了effect的自动依赖收集，即为state数据初次加载的时候自动将effect加入到自己的effect列表里。  \n在使用上，实现了react风格（其实更接近solid风格）的api方式，即为返回一个getter，一个setter。还实现了类Vue的ref风格api，不过没有对属性进行深层次的监听，因为深层次的监听大概率是必须使用`Proxy`，而Proxy的兼容性好像并不是很好。若不使用Proxy则必须大量的使用`Object.defineProperty`，这样就会陷入跟Vue2相同的困境里，因此直接采用了更直接的单向数据流，手动去触发一个更新。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmowtwo%2Fmow-reactive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmowtwo%2Fmow-reactive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmowtwo%2Fmow-reactive/lists"}