firebase-counter

1.0.3 • Public • Published

Build Status js-standard-style

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))

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i firebase-counter

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

6.72 kB

Total Files

9

Last publish

Collaborators

  • zrrrzzt