react-native-firebase/lib/modules/database/disconnect.js

57 lines
1.3 KiB
JavaScript
Raw Normal View History

2017-02-14 15:57:08 +00:00
/* @flow */
import { typeOf } from './../../utils';
2017-02-14 15:57:08 +00:00
import Reference from './reference';
/**
* @url https://firebase.google.com/docs/reference/js/firebase.database.OnDisconnect
* @class Disconnect
*/
export default class Disconnect {
ref: Reference;
2017-04-04 16:58:20 +00:00
path: string;
2017-02-14 15:57:08 +00:00
/**
*
* @param path Reference Path
*/
constructor(path: string) {
this.path = path;
}
/**
* @url https://firebase.google.com/docs/reference/js/firebase.database.OnDisconnect#set
* @param value
* @returns {*}
*/
set(value: string | Object) {
return this.database._native.onDisconnectSet(this.path, { type: typeOf(value), value });
2017-02-14 15:57:08 +00:00
}
/**
* @url https://firebase.google.com/docs/reference/js/firebase.database.OnDisconnect#update
* @param values
* @returns {*}
*/
update(values: Object) {
return this.database._native.onDisconnectUpdate(this.path, values);
2017-02-14 15:57:08 +00:00
}
/**
* @url https://firebase.google.com/docs/reference/js/firebase.database.OnDisconnect#remove
* @returns {*}
*/
remove() {
return this.database._native.onDisconnectRemove(this.path);
2017-02-14 15:57:08 +00:00
}
/**
* @url https://firebase.google.com/docs/reference/js/firebase.database.OnDisconnect#cancel
* @returns {*}
*/
cancel() {
return this.database._native.onDisconnectCancel(this.path);
2017-02-14 15:57:08 +00:00
}
}