{"id":29589140,"url":"https://github.com/juanbautista0/flux-proxy","last_synced_at":"2025-10-19T00:14:19.428Z","repository":{"id":305416880,"uuid":"1022820827","full_name":"juanbautista0/flux-proxy","owner":"juanbautista0","description":"A library to facilitate communication between contexts (iframes, webview, workers, processes) using a proxy pattern.","archived":false,"fork":false,"pushed_at":"2025-07-20T00:08:31.000Z","size":68,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-20T01:50:05.178Z","etag":null,"topics":["flux-proxy","iframe","iframe-embeds","webview"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/flux-proxy","language":"TypeScript","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/juanbautista0.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,"zenodo":null}},"created_at":"2025-07-19T22:48:28.000Z","updated_at":"2025-07-20T00:08:36.000Z","dependencies_parsed_at":"2025-07-20T02:03:23.830Z","dependency_job_id":null,"html_url":"https://github.com/juanbautista0/flux-proxy","commit_stats":null,"previous_names":["juanbautista0/flux-proxy"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/juanbautista0/flux-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juanbautista0%2Fflux-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juanbautista0%2Fflux-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juanbautista0%2Fflux-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juanbautista0%2Fflux-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juanbautista0","download_url":"https://codeload.github.com/juanbautista0/flux-proxy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juanbautista0%2Fflux-proxy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266067503,"owners_count":23871358,"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":["flux-proxy","iframe","iframe-embeds","webview"],"created_at":"2025-07-20T04:36:40.940Z","updated_at":"2025-10-19T00:14:14.390Z","avatar_url":"https://github.com/juanbautista0.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flux-Proxy\n\nA library to facilitate communication between contexts (iframes, webview, workers, processes) using a proxy pattern.\n\n## Installation\n\n```bash\nnpm install flux-proxy\n```\n\n## How It Works\n\nThe following diagram illustrates the communication flow between parent and child contexts using Flux-Proxy:\n\n```mermaid\nsequenceDiagram\n    participant Child as Child Context (iframe/webview/worker)\n    participant FluxChild as FluxProxy.childClient\n    participant FluxParent as FluxProxy.parentClient\n    participant Parent as Parent Context\n    participant DataSource as Data Handler\n    \n    Child-\u003e\u003eFluxChild: getData('collection', query)\n    FluxChild-\u003e\u003eParent: postMessage(action, payload)\n    Parent-\u003e\u003eFluxParent: onMessage(event.data)\n    FluxParent-\u003e\u003eDataSource: dataSource(message)\n    DataSource--\u003e\u003eFluxParent: return data\n    FluxParent--\u003e\u003eParent: postMessage(response)\n    Parent--\u003e\u003eFluxChild: message event\n    FluxChild--\u003e\u003eChild: return [data, error]\n```\n\n## Basic Usage\n\n```typescript\nimport { FluxProxy } from 'flux-proxy';\n\n// Usage in parent context\nconst handleData = async (message) =\u003e {\n  // Process the request and return data\n  return { result: 'processed data' };\n};\n\n// Listen for messages from child\nwindow.addEventListener('message', (event) =\u003e {\n  FluxProxy.parentClient.onMessage(\n    event.data,\n    window,\n    handleData\n  );\n});\n\n// Usage in child context (iframe)\nasync function fetchData() {\n  const [data, error] = await FluxProxy.childClient.getData('myCollection', { filter: 'value' });\n  \n  if (error) {\n    console.error('Error:', error);\n    return;\n  }\n  \n  console.log('Data received:', data);\n}\n```\n\n## Examples\n\nThe repository includes implementation examples for different platforms:\n\n### HTML\n\nBasic example of communication between a parent page and an iframe:\n\n- `examples/html/parent.html` - Parent page that loads an iframe\n- `examples/html/child.html` - Child page loaded in the iframe\n\n### React\n\nExample using React components:\n\n- `examples/react/ParentComponent.jsx` - Parent component\n- `examples/react/ChildComponent.jsx` - Child component\n\n### Angular\n\nExample using Angular components:\n\n- `examples/angular/parent.component.ts` - Parent component\n- `examples/angular/child.component.ts` - Child component\n\n### Node.js\n\nExample of communication between processes in Node.js:\n\n- `examples/node/parent-process.js` - Parent process\n- `examples/node/child-process.js` - Child process\n\n## Testing\n\nThe project includes unit tests. To run the tests:\n\n```bash\nnpm test\n```\n\nTo see the coverage report:\n\n```bash\nnpm run test:coverage\n```\n\nTo run tests in watch mode during development:\n\n```bash\nnpm run test:watch\n```\n\n### Video example use\n\n[![video]](https://drive.google.com/file/d/16MFViVwiH3K56dHbMaLkWmlgrV_TuyJV/view?usp=sharing)\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuanbautista0%2Fflux-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuanbautista0%2Fflux-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuanbautista0%2Fflux-proxy/lists"}