br24-event
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-rc.1 • Public • Published

@sep/br24-event

Install

yarn add @sep/br24-event

Usage

import EventManager, { Event } from '@sep/br24-event';

const em = new EventManager<Event.Database.Notification>({ topic: '<topic_name>' });

em.publish({
	channel: 'change',
	payload: {
		table: 'articles',
		action: 'UPDATE',
		newArticle: {
			// ...
		},
		oldArticle: {
			// ...
		},
	},
});

const subscription = em.subscribe('<subscription>', {
	flowControl: {
		allowExcessMessages: false,
		maxMessages: 3,
	},
});

subscription.on('message', (message) => {
	const payload = em.parse(message);

	// ...
});

Readme

Keywords

none

Package Sidebar

Install

npm i br24-event

Weekly Downloads

1

Version

1.0.0-rc.1

License

UNLICENSED

Unpacked Size

8.95 kB

Total Files

16

Last publish

Collaborators

  • mrboolean