{"id":18412821,"url":"https://github.com/rproenza86/events-distributor","last_synced_at":"2026-04-28T16:05:13.054Z","repository":{"id":96672409,"uuid":"162760936","full_name":"rproenza86/events-distributor","owner":"rproenza86","description":"NPM Module. Enable the events/actions communication between Micro Frontend/UI applications. Vanilla javascript implementation. Framework agnostic. CI/CD release train. 100% meaningful unit test coverture.","archived":false,"fork":false,"pushed_at":"2019-03-12T14:19:56.000Z","size":99,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T09:20:06.573Z","etag":null,"topics":["chai","codefactor","micro-ui","mocha","npm-module","travis-ci","typescript","typescript-library"],"latest_commit_sha":null,"homepage":"https://micro-ui-system.firebaseapp.com/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rproenza86.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2018-12-21T21:56:08.000Z","updated_at":"2019-04-26T17:44:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"77c6b488-2f15-4cbf-a84a-aed1dee016f3","html_url":"https://github.com/rproenza86/events-distributor","commit_stats":{"total_commits":32,"total_committers":1,"mean_commits":32.0,"dds":0.0,"last_synced_commit":"5d0c235db4c80ac0524ed173a703f0d3caf90177"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rproenza86%2Fevents-distributor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rproenza86%2Fevents-distributor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rproenza86%2Fevents-distributor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rproenza86%2Fevents-distributor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rproenza86","download_url":"https://codeload.github.com/rproenza86/events-distributor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647256,"owners_count":21139081,"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":["chai","codefactor","micro-ui","mocha","npm-module","travis-ci","typescript","typescript-library"],"created_at":"2024-11-06T03:43:39.032Z","updated_at":"2026-04-28T16:05:13.005Z","avatar_url":"https://github.com/rproenza86.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# events-distributor\n\n[![Build Status](https://travis-ci.org/rproenza86/events-distributor.svg?branch=master)](https://travis-ci.org/rproenza86/events-distributor)\n[![Code Factor/Quality](https://www.codefactor.io/repository/github/rproenza86/events-distributor/badge)](https://www.codefactor.io/repository/github/rproenza86/events-distributor)\n[![Coverage Status](https://coveralls.io/repos/github/rproenza86/events-distributor/badge.svg?branch=master)](https://coveralls.io/github/rproenza86/events-distributor?branch=master)\n[![npm (scoped)](https://img.shields.io/npm/v/@rproenza/events-distributor.svg)](https://www.npmjs.com/package/@rproenza/events-distributor)\n[![npm](https://img.shields.io/npm/dt/@rproenza/events-distributor.svg)](https://www.npmjs.com/package/@rproenza/events-distributor)\n[![license](https://img.shields.io/github/license/rproenza86/events-distributor.svg)](https://github.com/rproenza86/events-distributor/blob/master/LICENSE)\n\n\u003e System to enable communication between Micro UI/Frontend applications\n\n## Description\n\nNode.js package to use as NPM module. It will work as a helper utility to support Micro UI/Frontend architectures allowing the event communications among applications or modules.\n\nThe use of the `events-distributor` enable the proper encapsulation, low coupling and high cohesion which all scalable system must to have in order to achieve total indecency on his release train and Software Development Life Circle.\n\n## Table of Contents\n\n- [Installation](#installation)\n- [How to use](#usage)\n- [Test](#test)\n- [Contributing](#contributing)\n- [Concepts](#concepts)\n- [Support](#support)\n- [License](#license)\n\n## Installation\n```sh\nnpm install @rproenza/events-distributor --save\n\nyarn add @rproenza/events-distributor\n```\n\n## Usage\n\n### Module instantiation\n\n```javascript\nimport GlobalEventDistributor from '@rproenza/events-distributor';\n\nconst eventDistributor = new GlobalEventDistributor();\n```\n\n### Application registration\n\n```javascript\n/**\n * appStore = {\n *    dispatch: () =\u003e {},\n *    getStore: () =\u003e {}\n * }\n*/\neventDistributor.registerStore(appName, appStore);\n```\n\n### Events communications\n\n#### Broadcasting event\n\n```javascript\n/**\n * eventToBroadCast = {\n *    type: 'YOUR_GREAT_ACTION_SUCCESS,\n *    payload: {}\n * }\n*/\neventDistributor.dispatch(eventToBroadCast);\n```\n\n#### Sent event to specific application\n\n```javascript\n/**\n * directEventToAppB = {\n *    type: 'YOUR_GREAT_APP_A_ACTION_SUCCESS,\n *    payload: {}\n * }\n*/\neventDistributor.dispatch(directEventToAppB, appB.name);\n```\n\n### Get an application state\n\n```typescript\n/**\n * The function parameter is optional.\n * If omitted it will be returned the parent's app state\n*/\neventDistributor.getState(appTarget: string = '');\n```\n\n## Test\n\n```sh\nnpm run test\n```\n\n## Contributing\n\n*(see [Contributing Doc](CONTRIBUTING.md))\n\n## Concepts\n\n\u003e This module was inspired by [redux](https://redux.js.org) and its actions communication system.\n\n### Store\n\nObject with a `dispatch` function.\n\nEx. this `appA.store` :\n\n```javascript\n// Applications\nconst appA = {\n    name: 'MicroAppA',\n    store: {\n        dispatch: function(event) {\n            // App's event manipulation\n            const appACatch = {\n                ...event,\n                meta: 'Event catch on A'\n            };\n            // App logic\n            eventCatchQueue.push(appACatch);\n        }\n    }\n};\n```\n\n### Events\n\nObject passed as parameter  to the `dispatch` function.\n\n\u003e The `events` objects are like Redux's actions. They could hold any structure but there is a preferred framework which will ensure the proper module functioning under good practices.\n\nEx. of a basic and well structured event:\n\n```javascript\n// Applications\nconst event = {\n  type: 'UPDATE_TEST_DRIVE_DAY',\n  payload:{\n      date:  '2018-12-21T05:00:00.000Z'\n  },\n  meta: {\n    appSource: 'AppointmentDatePicker',\n    eventType: 'BROAD_CAST_ACTION',\n    state: {\n      testDrive: {\n        day: '2018-12-21T05:00:00.000Z',\n        email: 'Raul@gmail.com',\n        firstName: 'Raul',\n        hasError: false,\n        isCalculating: false,\n        lastName: 'Proenza',\n        phone: '123-624-4321',\n        time: 'Morning'\n      }\n    }\n  }\n};\n```\n\n## Support\n\n Create an [Issue](https://github.com/rproenza86/events-distributor/issues) for any bug or feature request.\n\n Expect a response within 2 business days after submitted your [bug report or feature request](https://github.com/rproenza86/events-distributor/issues). However, in many cases you'll see a response within 24 hours.\n\n## License\n\n[![license](https://img.shields.io/github/license/rproenza86/events-distributor.svg)](https://github.com/rproenza86/events-distributor/blob/master/LICENSE)\n\n- **[GNU General Public License version 3](LICENSE)**\n- Copyright 2025 © \u003ca href=\"https://atomiccoders.com\" target=\"_blank\"\u003eAtomic Coders\u003c/a\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frproenza86%2Fevents-distributor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frproenza86%2Fevents-distributor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frproenza86%2Fevents-distributor/lists"}