New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@uxland/event-aggregator

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uxland/event-aggregator - npm Package Compare versions

Comparing version 1.0.0-alpha.14 to 1.0.0-alpha.15

12

CHANGELOG.md

@@ -6,2 +6,14 @@ # Change Log

# [1.0.0-alpha.15](https://github.com/uxland/uxland/compare/@uxland/event-aggregator@1.0.0-alpha.14...@uxland/event-aggregator@1.0.0-alpha.15) (2020-10-15)
### Bug Fixes
* **event-aggregator:** solves typo ([aaa8241](https://github.com/uxland/uxland/commit/aaa82410df9b43ccb9e2ebce8b5a796a44b36ce9))
* **event-aggregator:** update documentation ([5a505e2](https://github.com/uxland/uxland/commit/5a505e2bf0435bc991212195bf86b7d0cdafe157))
# [1.0.0-alpha.14](https://github.com/uxland/uxland/compare/@uxland/event-aggregator@1.0.0-alpha.13...@uxland/event-aggregator@1.0.0-alpha.14) (2020-10-13)

@@ -8,0 +20,0 @@

2

dist/index.js

@@ -1,2 +0,2 @@

// Event Aggregator v1.0.0-alpha.13
// Event Aggregator v1.0.0-alpha.14
// https://github.com/uxland/uxland/tree/master/packages/event-aggregator#readme

@@ -3,0 +3,0 @@ // (c) 2020-2020 UXLand

@@ -6,3 +6,3 @@ export interface Subscription {

declare class EventAggregator {
eventLookup: object;
eventLookup: Record<string, any[]>;
messageHandlers: Array<any>;

@@ -34,3 +34,6 @@ constructor();

*
* `TBD`
* ```
* const callback = (payload: any): void => {};
* subscribe('EVENT-ID', callback);
* ```
*

@@ -50,3 +53,6 @@ */

*
* `TBD`
* ```
* const callback = (payload: any): void => {};
* subscribeOnce('EVENT-ID', callback);
* ```
*

@@ -67,3 +73,4 @@ */

*
* `TBD`
* const payload = { foo: 'bar' };
* publish('EVENT-ID', payload);
*

@@ -70,0 +77,0 @@ */

@@ -78,5 +78,5 @@ /*

if (!event) {
throw new Error('Event channel/type is invalid.');
throw new Error("Event channel/type is invalid.");
}
if (typeof event === 'string') {
if (typeof event === "string") {
subscribers = this.eventLookup[event];

@@ -103,5 +103,5 @@ if (subscribers) {

if (!event) {
throw new Error('Event channel/type is invalid.');
throw new Error("Event channel/type is invalid.");
}
if (typeof event === 'string') {
if (typeof event === "string") {
handler = callback;

@@ -121,3 +121,3 @@ subscribers = this.eventLookup[event] || (this.eventLookup[event] = []);

}
}
},
};

@@ -153,3 +153,6 @@ }

*
* `TBD`
* ```
* const callback = (payload: any): void => {};
* subscribe('EVENT-ID', callback);
* ```
*

@@ -169,3 +172,6 @@ */

*
* `TBD`
* ```
* const callback = (payload: any): void => {};
* subscribeOnce('EVENT-ID', callback);
* ```
*

@@ -186,5 +192,6 @@ */

*
* `TBD`
* const payload = { foo: 'bar' };
* publish('EVENT-ID', payload);
*
*/
export const publish = eventAggregator.publish.bind(eventAggregator);

@@ -6,3 +6,3 @@ export interface Subscription {

declare class EventAggregator {
eventLookup: object;
eventLookup: Record<string, any[]>;
messageHandlers: Array<any>;

@@ -34,3 +34,6 @@ constructor();

*
* `TBD`
* ```
* const callback = (payload: any): void => {};
* subscribe('EVENT-ID', callback);
* ```
*

@@ -50,3 +53,6 @@ */

*
* `TBD`
* ```
* const callback = (payload: any): void => {};
* subscribeOnce('EVENT-ID', callback);
* ```
*

@@ -67,3 +73,4 @@ */

*
* `TBD`
* const payload = { foo: 'bar' };
* publish('EVENT-ID', payload);
*

@@ -70,0 +77,0 @@ */

@@ -81,5 +81,5 @@ "use strict";

if (!event) {
throw new Error('Event channel/type is invalid.');
throw new Error("Event channel/type is invalid.");
}
if (typeof event === 'string') {
if (typeof event === "string") {
subscribers = this.eventLookup[event];

@@ -106,5 +106,5 @@ if (subscribers) {

if (!event) {
throw new Error('Event channel/type is invalid.');
throw new Error("Event channel/type is invalid.");
}
if (typeof event === 'string') {
if (typeof event === "string") {
handler = callback;

@@ -124,3 +124,3 @@ subscribers = this.eventLookup[event] || (this.eventLookup[event] = []);

}
}
},
};

@@ -156,3 +156,6 @@ }

*
* `TBD`
* ```
* const callback = (payload: any): void => {};
* subscribe('EVENT-ID', callback);
* ```
*

@@ -172,3 +175,6 @@ */

*
* `TBD`
* ```
* const callback = (payload: any): void => {};
* subscribeOnce('EVENT-ID', callback);
* ```
*

@@ -189,5 +195,6 @@ */

*
* `TBD`
* const payload = { foo: 'bar' };
* publish('EVENT-ID', payload);
*
*/
exports.publish = exports.eventAggregator.publish.bind(exports.eventAggregator);
{
"name": "@uxland/event-aggregator",
"version": "1.0.0-alpha.14",
"version": "1.0.0-alpha.15",
"description": "Event Aggregator",

@@ -75,3 +75,3 @@ "author": "UXLand <dev@uxland.es>",

},
"gitHead": "70ee1d1f6bb1e32bbab04edeb08a7de2ff20ca20"
"gitHead": "ef34536fe8292391766bfded70b4b9935003f4c8"
}

@@ -12,1 +12,28 @@ # UXL Event Aggregator [![npm version](https://badge.fury.io/js/%40uxland%2Fevent-aggregator.svg)](https://badge.fury.io/js/%40uxland%2Fevent-aggregator)

## Usage
### Event publish
To publish an event you must specify an eventId and an optional payload that will be collected by subscriber.
```typescript
const payload = { foo: 'bar' };
publish('EVENT-ID', payload);
```
### Event subscription
In order to subscribe to an event you must specify an eventId and a callback function that will be called when that event is received.
```typescript
const callback = (payload: any): void => {};
subscribe('EVENT-ID', callback);
```
### Event subscription (only once)
In order to subscribe to an event, only once, you must specify an eventId and a callback function that will be called when that event is received. For the next publishes of that event, this subscriber will not receive that event.
```typescript
const callback = (payload: any): void => {};
subscribeOnce('EVENT-ID', callback);
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc