npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rproenza/event-distributor

v1.3.6

Published

System to help components and Micro UI applications to communicate between each other

Downloads

1

Readme

events-distributor

Build Status Code Factor/Quality Coverage Status npm (scoped) npm license

System to enable communication between Micro UI/Frontend applications

Description

Node.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.

The 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.

Table of Contents

Installation

npm install @rproenza/events-distributor --save

yarn add @rproenza/events-distributor

Usage

Module instantiation

import GlobalEventDistributor from '@rproenza/events-distributor';

const eventDistributor = new GlobalEventDistributor();

Application registration

/**
 * appStore = {
 *    dispatch: () => {},
 *    getStore: () => {}
 * }
*/
eventDistributor.registerStore(appName, appStore);

Events communications

Broadcasting event

/**
 * eventToBroadCast = {
 *    type: 'YOUR_GREAT_ACTION_SUCCESS,
 *    payload: {}
 * }
*/
eventDistributor.dispatch(eventToBroadCast);

Sent event to specific application

/**
 * directEventToAppB = {
 *    type: 'YOUR_GREAT_APP_A_ACTION_SUCCESS,
 *    payload: {}
 * }
*/
eventDistributor.dispatch(directEventToAppB, appB.name);

Get an application state

/**
 * The function parameter is optional.
 * If omitted it will be returned the parent's app state
*/
eventDistributor.getState(appTarget: string = '');

Test

npm run test

Contributing

*(see Contributing Doc)

Concepts

This module was inspired by redux and its actions communication system.

Store

Object with a dispatch function.

Ex. this appA.store :

// Applications
const appA = {
    name: 'MicroAppA',
    store: {
        dispatch: function(event) {
            // App's event manipulation
            const appACatch = {
                ...event,
                meta: 'Event catch on A'
            };
            // App logic
            eventCatchQueue.push(appACatch);
        }
    }
};

Events

Object passed as parameter to the dispatch function.

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.

Ex. of a basic and well structured event:

// Applications
const event = {
  type: 'UPDATE_TEST_DRIVE_DAY',
  payload:{
      date:  '2018-12-21T05:00:00.000Z'
  },
  meta: {
    appSource: 'AppointmentDatePicker',
    eventType: 'BROAD_CAST_ACTION',
    state: {
      testDrive: {
        day: '2018-12-21T05:00:00.000Z',
        email: '[email protected]',
        firstName: 'Raul',
        hasError: false,
        isCalculating: false,
        lastName: 'Proenza',
        phone: '123-624-4321',
        time: 'Morning'
      }
    }
  }
};

Support

Create an Issue for any bug or feature request.

Expect a response within 2 business days after submitted your bug report or feature request. However, in many cases you'll see a response within 24 hours.

License

license