tcd-message-center v0.8.2
TCD Message Center
This is a backend in front-end library for TCD for messaging.
Install
Run the following command in your project
yarn add tcd-message-center # or npm install tcd-message-center
Usage
Import the main class which is MessageCenter
.
import { MessageCenter } from "tcd-message-center"
Create an instance of MessageCenter
const messageCenter = new MessageCenter({
auth: firebase.auth(),
storage: firebase.storage(),
functions: firebase.functions(),
realtime: firebase.database()
})
Retrieve Chat
objects from this messageCenter
object.
const chats: Chat[] = messageCenter.getChats(10, 0); // limit, offset
Now, you can start your work on each Chat
object whenever that object is ready.
import {ChatEvents, MessageEvents} from "tcd-message-center"
chat.on(ChatEvents.READY, () => {
//your code...
})
These ChatEvents
, MessageEvents
and CountEvents
are available on Chat
object.
CountEvents.Unread
is also available on MessageCenter
object to listen for total unread count on all chats.
API Docs
Class Chat
is an EventEmitter
class. So you can trigger and listen for events on any Chat
object.
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago