{"id":15730619,"url":"https://github.com/tuchk4/jsproxy","last_synced_at":"2025-03-31T02:46:20.294Z","repository":{"id":18063548,"uuid":"21123034","full_name":"tuchk4/jsproxy","owner":"tuchk4","description":null,"archived":false,"fork":false,"pushed_at":"2014-07-23T19:35:59.000Z","size":172,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-06T07:46:39.990Z","etag":null,"topics":[],"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/tuchk4.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}},"created_at":"2014-06-23T10:55:58.000Z","updated_at":"2014-06-25T17:53:43.000Z","dependencies_parsed_at":"2022-09-01T05:10:45.977Z","dependency_job_id":null,"html_url":"https://github.com/tuchk4/jsproxy","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/tuchk4%2Fjsproxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuchk4%2Fjsproxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuchk4%2Fjsproxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuchk4%2Fjsproxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tuchk4","download_url":"https://codeload.github.com/tuchk4/jsproxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246408100,"owners_count":20772228,"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-10-04T00:01:17.644Z","updated_at":"2025-03-31T02:46:20.276Z","avatar_url":"https://github.com/tuchk4.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"JS Proxy\n=======\n\n#Goal\n\nCall object's methods from another object\n\n```javascript\n return new Proxy({\n    // closure for creating object for proxying\n    $create: function(){\n      ...\n    },\n\n    // array of the methods that should be proxied\n    $methods: [...],\n\n    // additional methods\n    cancel: function(){\n      ...\n    }\n  });\n```\n\n\nExample:\nProxy methods from angularjs $http service and add custom `cancel` method:\n\n```javascript\n\nvar canceler = $q.defer();\n\nvar p = new Proxy({\n  $create: function(){\n    return $http({\n      ...\n      timeout: canceler.promise\n    });\n  },\n\n  $methods: ['then', 'catch', 'finally'],\n\n  cancel: function(){\n    return canceler.resolve();\n  }\n});\n\n// methods form $http service\np.then(...)\np.catch(...)\np.finally(...)\n\n// custom method\np.cancel()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuchk4%2Fjsproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftuchk4%2Fjsproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuchk4%2Fjsproxy/lists"}