Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 1.33 KB

functions.md

File metadata and controls

34 lines (26 loc) · 1.33 KB

RxFire Cloud Functions

Callable Functions Observables

httpsCallable()

The httpsCallable() function returns an observable that calls a callable function, then emits the data returned from that function.

function httpsCallable()
params functions: Functions, name: string, options?: HttpsCallableOptions
import path rxfire/functions
return (data: T) => Observable<R>

TypeScript Example

import { httpsCallable } from "rxfire/functions";
import { initializeApp } from "firebase/app";
import { getFunctions } from "firebase/functions";

// Set up Firebase
const app = initializeApp({
  /* config */
});
const functions = getFunctions(app);

// Assume an `uppercaser` function is deployed
const capitalizedText$ = httpsCallable<string, string>(functions, "uppercaser")("hello world");
capitalizedText$.subscribe((text) => {
  console.log(text);
}); // logs "HELLO WORLD"