JSPM

  • Created
  • Published
  • Downloads 1095988
  • Score
    100M100P100Q185953F
  • License MIT

Firebase SDK for Cloud Functions

Package Exports

  • firebase-functions
  • firebase-functions/lib/providers/https

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (firebase-functions) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

firebase-functions

The firebase-functions package provides an SDK for defining Firebase Functions.

Installation

In your Firebase project's functions directory, run:

npm install firebase-functions

Usage

// functions/index.js
var functions = require('firebase-functions');
var notifyUsers = require('./notify-users');

exports.newPost = functions.database
  .ref('/posts/{postId}')
  .onWrite(function(event) {
    // only execute function on creation
    if (!event.data.previous.exists()) {
      notifyUsers(event.data.val());
    }
  });