import {FirebaseDataSource} from 'arva-js/data/datasources/FirebaseDataSource.js'
FirebaseDataSource
Extends:
Constructor Summary
Public Constructor | ||
public |
constructor(path: String, options: Object): FirebaseDataSource |
Method Summary
Public Methods | ||
public |
authAnonymously(onComplete: Function, options: Object): Promise Authenticates all instances of this DataSource as an anonymous user. |
|
public |
authWithCustomToken(authToken: String, onComplete: Function): Promise Authenticates all instances of this DataSource with a custom auth token or secret. |
|
public |
Authenticates all instances of this DataSource with the given OAuth provider and credentials. |
|
public |
authWithPassword(credentials: String | Object, onComplete: Function): Promise Authenticates all instances of this DataSource with the given email/password credentials. |
|
public |
child(childName: String, options: Object): DataSource Returns a dataSource reference to the given child branch of the current datasource. |
|
public |
Fetches the current user's authentication state. If the user is authenticated, returns an object containing at least the fields uid, provider, auth, and expires. If the user is not authenticated, returns null. |
|
public |
Returns the name of the current branch in the path on the dataSource. |
|
public |
limitToFirst(amount: Number): DataSource Returns a new dataSource reference that will limit the subscription to only the first given amount items. |
|
public |
limitToLast(amount: Number): DataSource Returns a new dataSource reference that will limit the subscription to only the last given amount items. |
|
public |
Unsubscribe to a previously subscribed event. |
|
public |
Subscribe to an event emitted by the DataSource. |
|
public |
Subscribe to an event emitted by the DataSource once, and then immediately unsubscribe again once it has been emitted a single time. |
|
public |
orderByChild(childKey: String): DataSource Orders the DataSource's childs by the value in child[key]. |
|
public |
Orders the DataSource's childs by their key names, ignoring their priority. |
|
public |
Orders the DataSource's childs by their values, ignoring their priority. |
|
public |
Returns the full URL to the parent of the current branch on the dataSource. |
|
public |
Returns the full URL to the path on the dataSource. |
|
public |
push(newData: Object): FirebaseDataSource Writes newData to the path this dataSource was constructed with, appended by a random UID generated by the dataSource. |
|
public |
remove(): void Removes the object and all underlying children that this dataSource points to. |
|
public |
removeChildAddedCallback(): void this method was deprecated. Use the off() method instead.
Removes the callback set to trigger when dataSource adds a data element. |
|
public |
removeChildChangedCallback(): void this method was deprecated. Use the off() method instead.
Removes the callback set to trigger when dataSource changes a data element. |
|
public |
removeChildMovedCallback(): void this method was deprecated. Use the off() method instead.
Removes the callback set to trigger when dataSource moves a data element. |
|
public |
removeChildRemovedCallback(): void this method was deprecated. Use the off() method instead.
Removes the callback set to trigger when dataSource removes a data element. |
|
public |
removeValueChangedCallback(): void this method was deprecated. Use the off() method instead.
Removes the callback set to trigger when dataSource updates the data. |
|
public |
Returns the full URL to the root on the dataSource. |
|
public |
Writes newData to the path this dataSource was constructed with. |
|
public |
setChildAddedCallback(callback: Function): void this method was deprecated. Use the on() method instead.
Set the callback triggered when dataSource adds a data element. |
|
public |
setChildChangedCallback(callback: Function): void this method was deprecated. Use the on() method instead.
Set the callback triggered when dataSource changes a data element. |
|
public |
setChildMovedCallback(callback: Function): void this method was deprecated. Use the on() method instead.
Set the callback triggered when dataSource moves a data element. |
|
public |
setChildRemovedCallback(callback: Function): void this method was deprecated. Use the on() method instead.
Set the callback triggered when dataSource removes a data element. |
|
public |
setPriority(newPriority: String | Number): void Sets the priority (ordering) of an object on a given dataSource. |
|
public |
setValueChangedCallback(callback: Function): void this method was deprecated. Use the on() method instead.
Sets the callback triggered when dataSource updates the data. |
|
public |
setWithPriority(newData: Object, priority: String | Number): Promise Writes newData with given priority (ordering) to the path this dataSource was constructed with. |
|
public |
Resolves when the DataSource is synchronized to the server |
|
public |
Returns the full path to this dataSource's source on the remote storage provider. |
|
public |
unauth(): void Logs out from the datasource, allowing to re-authenticate at a later time. |
Inherited Summary
From class DataSource | ||
public get |
Indicate that the DataSource can be inherited when instantiating a list of models. |
|
public |
authAnonymously(onComplete: Function, options: Object): void Authenticates all instances of this DataSource as an anonymous user. |
|
public |
authWithCustomToken(authToken: String, onComplete: Function, options: Object): void Authenticates all instances of this DataSource with a custom auth token or secret. |
|
public |
authWithOAuthToken(provider: String, credentials: String | Object, onComplete: Function, options: Object): void Authenticates all instances of this DataSource with the given OAuth provider and credentials. |
|
public |
authWithPassword(credentials: String | Object, onComplete: Function, options: Object): void Authenticates all instances of this DataSource with the given email/password credentials. |
|
public |
child(childName: String, options: Object): DataSource Returns a dataSource reference to the given child branch of the current dataSource. |
|
public |
Fetches the current user's authentication state. If the user is authenticated, returns an object containing at least the fields uid, provider, auth, and expires. If the user is not authenticated, returns null. |
|
public |
Returns the name of the current branch in the path on the dataSource. |
|
public |
limitToFirst(amount: Number): DataSource Returns a new dataSource reference that will limit the subscription to only the first given amount items. |
|
public |
limitToLast(amount: Number): DataSource Returns a new dataSource reference that will limit the subscription to only the last given amount items. |
|
public |
Unsubscribe to a previously subscribed event. |
|
public |
Subscribe to an event emitted by the DataSource. |
|
public |
Subscribe to an event emitted by the DataSource once, and then immediately unsubscribe. |
|
public |
orderByChild(childKey: String): DataSource Orders the DataSource's childs by the value in child[key]. |
|
public |
Orders the DataSource's childs by their key names, ignoring their priority. |
|
public |
Orders the DataSource's childs by their values, ignoring their priority. |
|
public |
Returns the full URL to the path on the dataSource. |
|
public |
Writes newData to the path this dataSource was constructed with, appended by a random UID generated by the dataSource. |
|
public |
remove(): void Removes the object and all underlying children that this dataSource points to. |
|
public |
removeChildAddedCallback(): void Removes the callback set to trigger when dataSource adds a data element. |
|
public |
removeChildChangedCallback(): void Removes the callback set to trigger when dataSource changes a data element. |
|
public |
removeChildMovedCallback(): void Removes the callback set to trigger when dataSource moves a data element. |
|
public |
removeChildRemovedCallback(): void Removes the callback set to trigger when dataSource removes a data element. |
|
public |
removeValueChangedCallback(): void Removes the callback set to trigger when dataSource updates the data. |
|
public |
Writes newData to the path this dataSource was constructed with. |
|
public |
setChildAddedCallback(callback: Function): void Set the callback triggered when dataSource adds a data element. |
|
public |
setChildChangedCallback(callback: Function): void Set the callback triggered when dataSource changes a data element. |
|
public |
setChildMovedCallback(callback: Function): void Set the callback triggered when dataSource moves a data element. |
|
public |
setChildRemovedCallback(callback: Function): void Set the callback triggered when dataSource removes a data element. |
|
public |
setPriority(newPriority: String | Number): void Sets the priority (ordering) of an object on a given dataSource. |
|
public |
setValueChangedCallback(callback: Function): void Sets the callback triggered when dataSource updates the data. |
|
public |
setWithPriority(newData: Object, priority: String | Number): Promise Writes newData with given priority (ordering) to the path this dataSource was constructed with. |
|
public |
Resolves when the DataSource is synchronized to the server |
|
public |
Returns the full path to this dataSource's source on the remote storage provider. |
|
public |
unauth(): void Logs out from the datasource, allowing to re-authenticate at a later time. |
Public Constructors
public constructor(path: String, options: Object): FirebaseDataSource source
Override:
DataSource#constructorParams:
Name | Type | Attribute | Description |
path | String | Full path to resource in remote data storage. |
|
options | Object | Optional: options to construct the DataSource with. |
|
options.orderBy | String |
|
Optional, order all items received through the dataSource. Options are: '.priority', '.value', or a string containing the child key to order by (e.g. 'MyModelProperty') |
options.limitToFirst | Number |
|
Optional, only subscribe to the first amount of entries. |
options.limitToLast | Number |
|
Optional, only subscribe to the last amount of entries. |
options.synced | Promise |
|
Optional, a promise to tell the data source that it is only synchronized after this promise is resolved |
Public Members
public get dataReference: * source
public set dataReference: * source
public handlers: * source
public options: * source
Public Methods
public authAnonymously(onComplete: Function, options: Object): Promise source
Authenticates all instances of this DataSource as an anonymous user.
Override:
DataSource#authAnonymouslyParams:
Name | Type | Attribute | Description |
onComplete | Function | Callback, executed when login is completed either successfully or erroneously. On error, first argument is error message. On success, the first argument is null, and the second argument is an object containing the fields uid, provider, auth, and expires. |
|
options | Object | Optional, additional client arguments, such as configuring session persistence. |
public authWithCustomToken(authToken: String, onComplete: Function): Promise source
Authenticates all instances of this DataSource with a custom auth token or secret.
Override:
DataSource#authWithCustomTokenParams:
Name | Type | Attribute | Description |
authToken | String | Authentication token or secret. |
|
onComplete | Function | Callback, executed when login is completed either successfully or erroneously. On error, first argument is error message. On success, the first argument is null, and the second argument is an object containing the fields uid, provider, auth, and expires. |
public authWithOAuthToken(provider: String, credentials: String | Object, onComplete: Function): Promise source
Authenticates all instances of this DataSource with the given OAuth provider and credentials.
Override:
DataSource#authWithOAuthTokenParams:
Name | Type | Attribute | Description |
provider | String | google, facebook, github, or twitter |
|
credentials | String | Object | Access token string, or object with key/value pairs with e.g. OAuth 1.1 credentials. |
|
onComplete | Function | Callback, executed when login is completed either successfully or erroneously. On error, first argument is error message. On success, the first argument is null, and the second argument is an object containing the fields uid, provider, auth, and expires. |
public authWithPassword(credentials: String | Object, onComplete: Function): Promise source
Authenticates all instances of this DataSource with the given email/password credentials.
Override:
DataSource#authWithPasswordParams:
Name | Type | Attribute | Description |
credentials | String | Object | Object with key/value pairs {email: "value", password:"value"}. |
|
onComplete | Function | Callback, executed when login is completed either successfully or erroneously. On error, first argument is error message. On success, the first argument is null, and the second argument is an object containing the fields uid, provider, auth, and expires. |
public child(childName: String, options: Object): DataSource source
Returns a dataSource reference to the given child branch of the current datasource.
Override:
DataSource#childpublic getAuth(): Object | null source
Fetches the current user's authentication state. If the user is authenticated, returns an object containing at least the fields uid, provider, auth, and expires. If the user is not authenticated, returns null.
Override:
DataSource#getAuthpublic key(): String source
Returns the name of the current branch in the path on the dataSource.
Override:
DataSource#keypublic limitToFirst(amount: Number): DataSource source
Returns a new dataSource reference that will limit the subscription to only the first given amount items.
Override:
DataSource#limitToFirstParams:
Name | Type | Attribute | Description |
amount | Number | Amount of items to limit the dataSource to. |
public limitToLast(amount: Number): DataSource source
Returns a new dataSource reference that will limit the subscription to only the last given amount items.
Override:
DataSource#limitToLastParams:
Name | Type | Attribute | Description |
amount | Number | Amount of items to limit the dataSource to. |
public off(event: String, handler: Function): void source
Unsubscribe to a previously subscribed event. If no handler or context is given, all handlers for the given event are removed. If no parameters are given at all, all event types will have their handlers removed.
Override:
DataSource#offReturn:
void |
public on(event: String, handler: Function, context: Object): void source
Subscribe to an event emitted by the DataSource.
Override:
DataSource#onParams:
Name | Type | Attribute | Description |
event | String | Event type to subscribe to. Allowed values are: 'value', 'child_changed', 'child_added', 'child_removed', 'child_moved'. |
|
handler | Function | Function to call when the subscribed event is emitted. |
|
context | Object | Context to set 'this' to when calling the handler function. |
Return:
void |
public once(event: String, handler: Function, context: Object): void source
Subscribe to an event emitted by the DataSource once, and then immediately unsubscribe again once it has been emitted a single time.
Override:
DataSource#onceParams:
Name | Type | Attribute | Description |
event | String | Event type to subscribe to. Allowed values are: 'value', 'child_changed', 'child_added', 'child_removed', 'child_moved'. |
|
handler | Function | Function to call when the subscribed event is emitted. |
|
context | Object | Context to set 'this' to when calling the handler function. |
Return:
void |
public orderByChild(childKey: String): DataSource source
Orders the DataSource's childs by the value in child[key].
Override:
DataSource#orderByChildParams:
Name | Type | Attribute | Description |
childKey | String | Key of the field to order by. |
public orderByKey(): DataSource source
Orders the DataSource's childs by their key names, ignoring their priority.
Override:
DataSource#orderByKeypublic orderByValue(): DataSource source
Orders the DataSource's childs by their values, ignoring their priority.
Override:
DataSource#orderByValuepublic parent(): String source
Returns the full URL to the parent of the current branch on the dataSource.
public path(): String source
Returns the full URL to the path on the dataSource. Functionally identical to toString().
Override:
DataSource#pathpublic push(newData: Object): FirebaseDataSource source
Writes newData to the path this dataSource was constructed with, appended by a random UID generated by the dataSource.
Override:
DataSource#pushParams:
Name | Type | Attribute | Description |
newData | Object | New data to append to dataSource. |
public remove(): void source
Removes the object and all underlying children that this dataSource points to.
Override:
DataSource#removeReturn:
void |
public removeChildAddedCallback(): void source
Removes the callback set to trigger when dataSource adds a data element.
Override:
DataSource#removeChildAddedCallbackReturn:
void |
public removeChildChangedCallback(): void source
Removes the callback set to trigger when dataSource changes a data element.
Return:
void |
public removeChildMovedCallback(): void source
Removes the callback set to trigger when dataSource moves a data element.
Override:
DataSource#removeChildMovedCallbackReturn:
void |
public removeChildRemovedCallback(): void source
Removes the callback set to trigger when dataSource removes a data element.
Return:
void |
public removeValueChangedCallback(): void source
Removes the callback set to trigger when dataSource updates the data.
Return:
void |
public set(newData: Object): Promise source
Writes newData to the path this dataSource was constructed with.
Override:
DataSource#setParams:
Name | Type | Attribute | Description |
newData | Object | Data to write to dataSource. |
public setChildAddedCallback(callback: Function): void source
Set the callback triggered when dataSource adds a data element.
Override:
DataSource#setChildAddedCallbackParams:
Name | Type | Attribute | Description |
callback | Function | Callback function to call when a new data child is added. |
Return:
void |
public setChildChangedCallback(callback: Function): void source
Set the callback triggered when dataSource changes a data element.
Override:
DataSource#setChildChangedCallbackParams:
Name | Type | Attribute | Description |
callback | Function | Callback function to call when a child is changed. |
Return:
void |
public setChildMovedCallback(callback: Function): void source
Set the callback triggered when dataSource moves a data element.
Override:
DataSource#setChildMovedCallbackParams:
Name | Type | Attribute | Description |
callback | Function | Callback function to call when a child is moved. |
Return:
void |
public setChildRemovedCallback(callback: Function): void source
Set the callback triggered when dataSource removes a data element.
Override:
DataSource#setChildRemovedCallbackParams:
Name | Type | Attribute | Description |
callback | Function | Callback function to call when a child is removed. |
Return:
void |
public setPriority(newPriority: String | Number): void source
Sets the priority (ordering) of an object on a given dataSource.
Override:
DataSource#setPriorityReturn:
void |
public setValueChangedCallback(callback: Function): void source
Sets the callback triggered when dataSource updates the data.
Override:
DataSource#setValueChangedCallbackParams:
Name | Type | Attribute | Description |
callback | Function | Callback function to call when the subscribed data value changes. |
Return:
void |
public setWithPriority(newData: Object, priority: String | Number): Promise source
Writes newData with given priority (ordering) to the path this dataSource was constructed with.
Override:
DataSource#setWithPrioritypublic synced(): Promise source
Resolves when the DataSource is synchronized to the server
Override:
DataSource#syncedpublic toString(): String source
Returns the full path to this dataSource's source on the remote storage provider.
Override:
DataSource#toStringpublic unauth(): void source
Logs out from the datasource, allowing to re-authenticate at a later time.
Override:
DataSource#unauthReturn:
void |