new FirebaseFactory(fbRef)
Parameters:
Name | Type | Description |
---|---|---|
fbRef |
Firebase | A Firebase reference |
Methods
(static) expandPath(path) → {Firebase}
Expand a generic Firebase path and return a reference to it.
Parameters:
Name | Type | Description |
---|---|---|
path |
Array.<string> | string | A string or an array of path components that will be concatenated with '/' as the separator. Ex: ['foo', 'bar', 'baz'] will become 'foo/bar/baz' |
Returns:
A Firebase reference.
- Type
- Firebase
(static) load(path) → {Promise.<Object>}
Helper to load data from Firebase.
Parameters:
Name | Type | Description |
---|---|---|
path |
Array.<string> | string | A string or an array of path components that will be concatenated with '/' as the separator. Ex: ['foo', 'bar', 'baz'] will become 'foo/bar/baz' |
Returns:
- Type
- Promise.<Object>
(static) save(path, data) → {Promise}
Helper to save arbitrary data to Firebase.
Parameters:
Name | Type | Description |
---|---|---|
path |
Array.<string> | An array of path components that will be concatenated with '/' as the separator. Ex: ['foo', 'bar', 'baz'] will become 'foo/bar/baz' |
data |
Object |
Returns:
- Type
- Promise
(static) transaction(path, updateFunction, applyLocally) → {Promise.<(string|number|boolean)>}
Atomically modifies and then returns the data at this location. Full firebase documentation:
https://www.firebase.com/docs/web/api/firebase/transaction.html
Parameters:
Name | Type | Description |
---|---|---|
path |
Array.<string> | An array of path components that will be concatenated with '/' as the separator. Ex: ['foo', 'bar', 'baz'] will become 'foo/bar/baz' |
updateFunction |
updateFunction | A developer-supplied function which will be passed the current data stored at this location (as a JavaScript object). The function should return the new value it would like written (as a JavaScript object). If undefined is returned (i.e. you return with no arguments) the transaction will be aborted and the data at this location will not be modified. |
applyLocally |
boolean | By default, events are raised each time the transaction update function runs. So if it is run multiple times, you may see intermediate states. You can set this to false to suppress these intermediate states and instead wait until the transaction has completed before events are raised. |
Returns:
Value from the onComplete Function
- Type
- Promise.<(string|number|boolean)>