Skip to content

0snova/events-firebase

Repository files navigation

@osnova/events-firebase

Install

# npm
npm install @osnova/events @osnova/events-firebase firebase --save
# yarn
yarn add @osnova/events @osnova/events-firebase firebase

Usage

FirestoreConnector

Request connector that writes request events as documents to requestsCollection and listens responsesCollection for responses to that events.

import { FirestoreConnector } from '@osnova/events-firebase';

const connector = new FirestoreConnector(firebase, {
  requestsCollection: 'requests',
  responsesCollection: 'responses',
  // will delete processed response event if `true`
  deleteResponse: true,
});

connector.request({ type: 'ping', payload: void 0 }).then((response) => {
  console.log(response);
});

First parameter of FirestoreConnector is an initialized Firebase application (firebase.app.App).

@osnova/firebase-client can be used to easily initialize Firebase.

About

@osnova/events bindings for Firebase

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published