Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dark64/cuspin

Minimal Event Manager
https://github.com/dark64/cuspin

Last synced: 4 days ago
JSON representation

Minimal Event Manager

Awesome Lists containing this project

README

        

# cuspin
> Minimal JavaScript Event Manager

## Install

```bash
npm install cuspin
```

## Usage

```javascript
import { subscribe, subscribeOnce, emit } from 'cuspin';

// subscribe to an event
subscribe('example', (args) => {
console.log(args)
})

// subscribe once to an event
subscribeOnce('example', (args) => {
console.log(args);
})

// emit event
emit('example', 'Hello world!');
emit('example', { message: 'Hello world!' });
emit('example', ['Hello', 'world!']);
```