@osnova/events-firebase
v0.4.0
Published
@osnova/events bindings for Firebase
Downloads
34
Readme
@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.