Function
| Static Public Summary | ||
| public |
* create(path: *, fn: *): * Saves new data to the database with |
|
| public |
* get(path: *, key: *): * | any Fetches a record specified by the key from the database |
|
| public |
* getAll(path: *): * | any Fetches entire snapshot of the database |
|
| public |
* push(path: *, fn: *): * Generates a new child location using a unique key |
|
| public |
* remove(path: *, key: *): * Deletes a given child location using a unique key |
|
| public |
|
|
| public |
* update(path: *, key: *, payload: *): * |
|
Static Public
public * create(path: *, fn: *): * source
import {create} from 'firebase-saga/src/index.js'Saves new data to the database with set()
Params:
| Name | Type | Attribute | Description |
| path | * | ||
| fn | * |
Return:
| * |
Example:
import { create } from 'firebase-saga';
yield call(create, 'posts', () => ({
[`posts/1234`]: {
title: 'My Second Post',
body: 'Second post details',
timestamp: +new Date
}
})
);
public * get(path: *, key: *): * | any source
import {get} from 'firebase-saga/src/index.js'Fetches a record specified by the key from the database
Params:
| Name | Type | Attribute | Description |
| path | * | ||
| key | * |
Return:
| * | any | import { get } from 'firebase-saga'; const posts = yield call(get, 'posts', '1234'); |
public * getAll(path: *): * | any source
import {getAll} from 'firebase-saga/src/index.js'Fetches entire snapshot of the database
Params:
| Name | Type | Attribute | Description |
| path | * |
Return:
| * | any |
Example:
import { getAll } from 'firebase-saga';
const posts = yield call(getAll, 'posts');
public * push(path: *, fn: *): * source
import {push} from 'firebase-saga/src/index.js'Generates a new child location using a unique key
Params:
| Name | Type | Attribute | Description |
| path | * | ||
| fn | * |
Return:
| * |
Example:
import { push } from 'firebase-saga';
yield call(push, 'posts', () => ({
title: formData.title,
body: formData.body,
timestamp: formData.timestamp
})
);
public * remove(path: *, key: *): * source
import {remove} from 'firebase-saga/src/index.js'Deletes a given child location using a unique key
Params:
| Name | Type | Attribute | Description |
| path | * | ||
| key | * |
Return:
| * |
Example:
import { remove } from 'firebase-saga';
yield call(remove, 'posts', '1234')
public * sync(path: *, mapEventToAction: {}, limit: number) source
import {sync} from 'firebase-saga/src/index.js'Params:
| Name | Type | Attribute | Description |
| path | * | ||
| mapEventToAction | {} |
|
|
| limit | number |
|
public * update(path: *, key: *, payload: *): * source
import {update} from 'firebase-saga/src/index.js'Params:
| Name | Type | Attribute | Description |
| path | * | ||
| key | * | ||
| payload | * |
Return:
| * |