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

https://github.com/haricharank9/pub-sub-topic-ts

Topic-based Publish-Subscribe pattern library TypeScript implementation.
https://github.com/haricharank9/pub-sub-topic-ts

design-pattern javascript publisher pubsub subscriber topic typescript typescript-library

Last synced: 6 months ago
JSON representation

Topic-based Publish-Subscribe pattern library TypeScript implementation.

Awesome Lists containing this project

README

          

# pub-sub-topic-ts
Topic based Publish-Subscribe pattern library TypeScript implementation.

### Installation
```sh
npm install pub-sub-topic-ts
```

### API

```typescript
// subscribe to a topic
subscribe(name: string, callback: (data: T[]) => void): Subscriber

// publish to a topic
publish(topicName: string, data: T): void

//unsubscribe from topic
unsubscribe(subscriber: Subscriber): void

//delete a topic
deleteTopic(name: string): void

//get list of topics
getTopics(): string[]
```