common-messanger
TypeScript icon, indicating that this package has built-in type declarations

1.7.3 • Public • Published

common-messanger

Install App

$ yarn add common-messanger
import * as firebase from 'firebase/app'
import { installApp } from 'common-messanger'
import 'firebase/auth'
import 'firebase/firestore'
 
const app = firebase.initializeApp({
  "apiKey": apiKey,
  "authDomain": authDomain,
  "databaseURL": databaseURL,
  "projectId": projectId,
  "storageBucket": storageBucket,
  "messagingSenderId": messagingSenderId,
  "appId": appId
})
const firestore = firebase.firestore(app)
installApp(firestore)

Test

$ yarn test

Don't forget call dispose

import {
  MessageObserver,
} from 'common-messanger'
 
// initialized
const messageObserver = new MessageObserver()
 
// just call once
messageObserver.messages$
  .pipe(map((data) => data.messages))
  .subscribe((messages) => this.setState({ messages }))
 
// when you want to fetch all messages
messageObserver.fetchMessage(roomId)
 
// when component will unmount
messageObserver.dispose()

Readme

Keywords

none

Package Sidebar

Install

npm i common-messanger

Weekly Downloads

22

Version

1.7.3

License

MIT

Unpacked Size

123 kB

Total Files

126

Last publish

Collaborators

  • ayakayakak
  • k-okina
  • oreno4649
  • tameto