An event management system.

Overview

GitHub Workflow Status (branch) npm bundle size npm GitHub last commit GitHub

What is the purpose?

It's a very tiny library for publish/subscribe(pubsub) operations. There's no dependency. It's only 933(gziped: 437) byte. Written in TypeScript

Tests Coverage

100% coverage.

Usage

Install package

# NPM
npm install tiny-tiny-pubsub

# Yarn
yarn add tiny-tiny-pubsub

Register a function

import pubsub from 'tiny-tiny-pubsub';
pubsub.on('test', (data) => {
  console.log('called with ' + data);
});

Unregister a function

import pubsub from 'tiny-tiny-pubsub';
pubsub.off('test', fn);

Trigger

import pubsub from 'tiny-tiny-pubsub';
pubsub.trigger('test', 'sample data');

Clear

It clears all event listeners.

import pubsub from 'tiny-tiny-pubsub';
pubsub.clear();

Wildcard support

Pubsub be able to support wildcard text matching.

For example:

If there are event registrations as below and user calls it with trigger method.

pubsub.on("john", () => console.log("john");
pubsub.on("john.doe", () => console.log("john's name");
pubsub.on("john.doe.mail", () => console.log("john's mail");
pubsub.trigger("john.*")

all previously defined functions must be called except "john".

// console output
"john's name";
"john's mail";

or user should be able to remove event listeners based on wildcards.

pubsub.off('john.*');
pubsub.trigger('john');
pubsub.trigger('john.doe');
pubsub.trigger('john.doe.mail');
// console output
'john';

there must be only one listener in listeners array that is "john" Because user removed all listeners which matched with wildcard query that ends with asterix except "john".

Licence

MIT

You might also like...

Crypto APIs - Key Management System Tool (KMS)

Crypto APIs - Key Management System Tool (KMS) Crypto APIs KMS (Key Management System) is an open-source Node.js library. It gives companies full cust

Dec 22, 2022

Arabic-first task management system

Arabic-first task management system

Labeeb An Arabic-first, open-source Tasks Management System created for Damascus University's third year project, Faculty of Information Technology. F

Dec 30, 2022

A Nest.js API for a restaurant storage management system.

Restaurant Storage Management System Description A Nest.js API for a restaurant storage management system. Installation $ yarn install Database Seeder

Sep 12, 2022

Its a Advanced Content Management System built on top of Frappe.

Its a Advanced Content Management System built on top of Frappe.

Go1 CMS Go1 CMS - Its a Advanced Content Management System built on top of Frappe with Advanced Page builder. Lead your business towards the future of

Dec 29, 2022

[WIP] A micro content management system

T8 CMS T8 is a minimal CMS for static sites and blogs. Tech Stack ReactJS TypeScript Material UI Styled Components Supabase(BaaS) Project Folder Struc

Oct 15, 2022

The Main Purpose The main purpose of creating an anaonline information system, as an effort responsive to the management of the data of the Members of the Persis Youth based on information technology systems

landing-page-pp landing-page-pp.vercel.app #The Main Purpose The main purpose of creating an anaonline information system, as an effort responsive to

Oct 21, 2022

A bodacious, secure, headless content management system.

A bodacious, secure, headless content management system. Cassiopeia allows you to create your blog with a customizable interface and comes with a dyna

Jan 6, 2023

Denail of service system for the Dentistimo system. Used to improve the tolerance and testing fail safe functionality.

 Denail of service system for the Dentistimo system. Used to improve the tolerance and testing fail safe functionality.

Distributed Systems - Dos Testing DoS (Denail of Service) System for Testing and Practical demonstration of systems capability to handle a basic DDoS

Nov 8, 2022
Comments
  • Add wildcard support

    Add wildcard support

    Pubsub should be able to support wildcard text matching.

    For example:

    If there are event registration definitions as below and user calls it with trigger method.

    pubsub.on("john", () => console.log("john");
    pubsub.on("john.doe", () => console.log("john's name");
    pubsub.on("john.doe.mail", () => console.log("john's mail");
    pubsub.trigger("john.*")
    

    all previously defined functions must be called except "john".

    // console output
    "john's name"
    "john's mail"
    

    or user should be able to remove event listeners based on wildcards.

    pubsub.off("john.*");
    pubsub.trigger("john");
    pubsub.trigger("john.doe");
    pubsub.trigger("john.doe.mail");
    
    // console output
    "john"
    

    there must be only one listener in listeners array that is "john" Because user removed all listeners which matched with wildcard query that ends with asterix except "john".

    enhancement good first issue released 
    opened by ivanfuzuli 1
Releases(v1.2.0)
Owner
Can Küçükyılmaz
Senior Front-end Developer
Can Küçükyılmaz
An event management system.

What is the purpose? It's a very tiny library for publish/subscribe(pubsub) operations. There's no dependency. It's only 933(gziped: 437) byte. Writte

Can Küçükyılmaz 7 Mar 2, 2022
io-ts Typed Event Bus for the runtime of your Node.js application. A core for any event-driven architecture based app.

Typed Event Bus Based on io-ts types, this bus provides a handy interface to publish and consume events in the current runtime of the Node.js process.

Konstantin Knyazev 3 May 23, 2022
'event-driven' library aims to simplify building backends in an event driven style

'event-driven' library aims to simplify building backends in an event driven style(event driven architecture). For message broker, light weight Redis Stream is used and for event store, the well known NoSQL database, MongoDB, is used.

Sihoon Kim 11 Jan 4, 2023
Firebase Angular Skeleton - Quickly create an application with a fully functional authentication, authorization and user management system.

FAngS - Firebase Angular Skeleton FAngS lets you quickly create an application with a fully functional authentication, authorization and user manageme

Ryan Lefebvre 7 Sep 21, 2022
Full Stack Server management system

This is Full Stack Server management system. which is build in Spring boot and Angular 11. with full Security Auth and JWT in Backend and session based surity in frontend. with two 2 dashboard and public content.

Rohit Ghadge 2 Mar 20, 2022
A 👩‍💻 developer-friendly entity management system for 🕹 games and similarly demanding applications, based on 🛠 ECS architecture.

Miniplex Ecosystem miniplex miniplex-react Introduction Miniplex is an entity management system for games and similarly demanding applications. Instea

Hendrik Mans 253 Dec 31, 2022
A library management system that built with JavaScript, HTML, and CSS. Allows the user to add new books and delete books.

Awesome books: with ES6 in this project: Set up the linters for html, css, and JavaScript. Create a popup window for desktop and mobile. Built With Ht

IBRAHIM AHMAT 7 Dec 18, 2022
Employee Management System is a web application developed using Django(Backend) which manages the record of employees, their salary, attendance. publish public notices, assign works to employees, make requests to employees.

Employee_Management_System Employee Management System is a web application developed using Django(Backend) which manages the record of employees, thei

Preet Nandasana 7 Dec 16, 2022
The project integrates workflow engine, report engine and organization authority management background, which can be applied to the development of OA, HR, CRM, PM and other systems. With tlv8 IDE, business system development, testing and deployment can be realized quickly.

介绍 项目集成了工作流引擎、报表引擎和组织机构权限管理后台,可以应用于OA、HR、CRM、PM等系统开发。配合使用tlv8 ide可以快速实现业务系统开发、测试、部署。 后台采用Spring MVC架构简单方便,前端使用流行的layui界面美观大方。 采用组件开发技术,提高系统的灵活性和可扩展性;采

Qian Chen 38 Dec 27, 2022
Evolve is an online investment portfolio management system where users can keep track of all the assets that they have invested in and how well their assets are performing.

Evolve is an online investment portfolio management system where users can keep track of all the assets that they have invested in and how well their assets are performing.

Indrajit 6 Oct 16, 2022