Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/akarachen/lime

A quite simple pub-sub implement.
https://github.com/akarachen/lime

Last synced: 5 days ago
JSON representation

A quite simple pub-sub implement.

Awesome Lists containing this project

README

        

# Lime

A quite simple pub-sub implement.

## Example

```ts
import { lime } from '@akrc/lime'

let count = 0
const emitter = lime()
const handler = event => (count + event)
emitter.subscribe('increment', handler)
emitter.publish('increment', 2)
console.log(count) // 2
emitter.unsubscribe('increment', handler)
emitter.publish('increment', 1) // nothing happened
```