Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/akarachen/lime
- Owner: AkaraChen
- License: unlicense
- Created: 2023-01-22T17:19:22.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-06T15:36:25.000Z (over 1 year ago)
- Last Synced: 2024-10-24T04:03:13.094Z (14 days ago)
- Language: TypeScript
- Homepage:
- Size: 109 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```