{"id":20698831,"url":"https://github.com/rwson/proxy-obverse","last_synced_at":"2026-06-08T07:33:44.701Z","repository":{"id":87105489,"uuid":"82868904","full_name":"rwson/Proxy-obverse","owner":"rwson","description":"通过ES6 Proxy实现的监测数据变化","archived":false,"fork":false,"pushed_at":"2017-05-17T08:47:36.000Z","size":22,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-19T15:56:44.147Z","etag":null,"topics":["es6-proxies","proxy-obverse"],"latest_commit_sha":null,"homepage":null,"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/rwson.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":"2017-02-23T01:07:16.000Z","updated_at":"2023-09-08T17:21:22.000Z","dependencies_parsed_at":"2023-07-04T22:30:32.015Z","dependency_job_id":null,"html_url":"https://github.com/rwson/Proxy-obverse","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rwson/Proxy-obverse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwson%2FProxy-obverse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwson%2FProxy-obverse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwson%2FProxy-obverse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwson%2FProxy-obverse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwson","download_url":"https://codeload.github.com/rwson/Proxy-obverse/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwson%2FProxy-obverse/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34053435,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"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":["es6-proxies","proxy-obverse"],"created_at":"2024-11-17T00:27:02.763Z","updated_at":"2026-06-08T07:33:44.673Z","avatar_url":"https://github.com/rwson.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#Proxy-obverse\n\n通过ES6 Proxy实现的监测数据变化(支持多级对象或数组)\n\n### Usage\n\n- 测试\n\n    git clone https://github.com/rwson/Proxy-obverse\n    \n    cd Proxy-obverse\n    \n    npm install\n    \n    npm test\n\n- 引用\n\n    git clone https://github.com/rwson/Proxy-obverse\n    \n    将代码拷贝到项目目录下,通过commonJS的方式引用即可\n\n\n### API\n\n    var observe = require(path/to/Proxy-obverse);\n\n    var arr = [\n        1,\n        2,\n        3,\n        [\n            4,\n            5,\n            6\n        ]\n    ];\n\n\n    var arrOb = observe(arr, function(type, changed, oldV, newV) {\n    \n    //  当被监测的值发生变化时,触发回调函数\n    \n    });\n    \n    arrOb.push(5);\n    arrOb[3].shift();\n    \n    //  ...\n\n回调参数:\n\n\n参数名 | 意义 | 类型\n---|---|---\ntype | 对数据所做的操作 | String\nchanged | 修改的值 | Array/Object/Number/String etc.\noldV | 原来的值 | Array\nnewV | 修改后的值 | Array\n\n\n    var observe = require(path/to/Proxy-obverse);\n\n    var obj = {\n        name: \"foo\"\n    };\n\n\n    var objOb = observe(obj, function(type, prop, oldV, newV) {\n    \n    //  当被监测的值发生变化时,触发回调函数\n    \n    });\n    \n    objOb.name = \"bar\";\n    objOb.year = 2017;\n    \n    //  ...\n\n回调参数:\n\n\n参数名 | 意义 | 类型\n---|---|---\ntype | 对数据所做的操作 | String\nprop | 修改的属性名 | String\noldV | 原来的值 | Array/Object/Number/String etc.\nnewV | 修改后的值 | Array/Object/Number/String etc.\n\n\n\n### Tips\n\n触发回调函数的条件是对数据产生直接变化的操作。当数据类型为数组时,push/pop/shift/unshift/splice或者直接修改某个下标的值这些操作,都会触发后面的回调函数;当数据类型为对象时,直接修改某个属性值或者新增一个属性值时,也会触发后面的回调函数。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwson%2Fproxy-obverse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwson%2Fproxy-obverse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwson%2Fproxy-obverse/lists"}