{"id":18152239,"url":"https://github.com/bsdelf/forwardit","last_synced_at":"2025-04-06T23:45:53.016Z","repository":{"id":57241035,"uuid":"262019660","full_name":"bsdelf/forwardit","owner":"bsdelf","description":"Forwarding marker and installer.","archived":false,"fork":false,"pushed_at":"2020-05-13T08:47:22.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-13T05:44:52.918Z","etag":null,"topics":["forward","forwardable","forwarding","javascript","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/bsdelf.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":"2020-05-07T10:26:56.000Z","updated_at":"2020-05-13T08:47:25.000Z","dependencies_parsed_at":"2022-09-07T23:13:02.909Z","dependency_job_id":null,"html_url":"https://github.com/bsdelf/forwardit","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/bsdelf%2Fforwardit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsdelf%2Fforwardit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsdelf%2Fforwardit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsdelf%2Fforwardit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bsdelf","download_url":"https://codeload.github.com/bsdelf/forwardit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247569130,"owners_count":20959758,"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":["forward","forwardable","forwarding","javascript","typescript"],"created_at":"2024-11-02T02:06:06.085Z","updated_at":"2025-04-06T23:45:52.994Z","avatar_url":"https://github.com/bsdelf.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# forwardit\n\nForwarding marker and installer.\n\n## Installation\n\n```\nnpm i forwardit\n```\n\n## Usage\n\nBasic usage in JavaScript:\n\n```javascript\nconst { forward, installForwards, uninstallForwards } = require('forwardit');\n\nclass Data {\n  @forward\n  value = 0;\n\n  @forward\n  inc() {\n    this.value++;\n  }\n}\n\nconst data = new Data();\nconst broker = {};\n\ninstallForwards(broker, data);\nconsole.log(broker.value, data.value); // 0, 0\n\nbroker.inc();\nconsole.log(broker.value, data.value); // 1, 1\n\ndata.inc();\nconsole.log(broker.value, data.value); // 2, 2\n\nuninstallForwards(broker, data);\nconsole.log(broker.value, data.value); // undefined, 2\n```\n\nFor TypeScript, we need to argument broker's type information to avoid compiler errors and make code completion working correctly:\n\n```typescript\n// declare Broker as usual\nclass Broker {\n  // Broker's own properties\n}\n\n// argument Broker with selected properties from Data\ninterface Broker extends Pick\u003cData, 'value' | 'inc'\u003e {}\n\n// create instances, install forwards...\n\n// now code completion works for \"value\" and \"inc\", no more compiler errors\nbroker.value;\nbroker.inc;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsdelf%2Fforwardit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbsdelf%2Fforwardit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsdelf%2Fforwardit/lists"}