1.0.3 • Published 5 years ago
firebase-counter v1.0.3
firebase-counter
Counter with firebase backend
Installation
$ npm i firebase-counter
Usage
Add, subtract og lookup values for a specific key in firebase.
- Uses
value
as key if no key supplied. - Defaults to 1 if no value is presented.
- Supports promises and callbacks
const fbc = require('firebase-counter')
const counterOptions = {
apiKey: '<your-api-key>',
authDomain: '<your-auth-domain>',
databaseURL: '<your-database-url>',
appName: '<your-app-name>',
authEmail: '<your-auth-email>',
authPassword: '<your-auth-password>'
}
const counter = fbc(counterOptions)
counter.add({'key': 'fishy', value: 10}).then(data => console.log(data))
counter.subtract({'key': 'fishy', value: 5}).then(data => console.log(data))
counter.lookup({'key': 'fishy'}).then(data => console.log(data))