Skip to content

Commit

Permalink
Add docs for functions (#30)
Browse files Browse the repository at this point in the history
* add docs for functions

Co-authored-by: David East <[email protected]>
  • Loading branch information
jhuleatt and davideast authored Oct 20, 2021
1 parent 8a3efd1 commit 26ff132
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ const url$ = getDownloadURL(ref);
- [Authentication](docs/auth.md)
- [Storage](docs/storage.md)
- [Realtime Database](docs/database.md)
- [Cloud Functions](docs/functions.md)
## Examples
Expand Down
34 changes: 34 additions & 0 deletions docs/functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# RxFire Cloud Functions

## Callable Functions Observables

### `httpsCallable()`

The `httpsCallable()` function returns an observable that calls a [callable function](https://firebase.google.com/docs/functions/callable), 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

```ts
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"
```

0 comments on commit 26ff132

Please sign in to comment.