database.onDisconnect class - js
This commit is contained in:
parent
081adee1dc
commit
3601a85e15
57
lib/modules/database/disconnect.js
Normal file
57
lib/modules/database/disconnect.js
Normal file
@ -0,0 +1,57 @@
|
||||
/* @flow */
|
||||
|
||||
import { NativeModules } from 'react-native';
|
||||
import { promisify, typeOf } from './../../utils';
|
||||
import Reference from './reference';
|
||||
|
||||
const FirebaseDatabase = NativeModules.FirebaseDatabase;
|
||||
|
||||
/**
|
||||
* @url https://firebase.google.com/docs/reference/js/firebase.database.OnDisconnect
|
||||
* @class Disconnect
|
||||
*/
|
||||
export default class Disconnect {
|
||||
ref: Reference;
|
||||
|
||||
/**
|
||||
*
|
||||
* @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 promisify('onDisconnectSet', FirebaseDatabase)(this.path, { type: typeOf(typeOf), value });
|
||||
}
|
||||
|
||||
/**
|
||||
* @url https://firebase.google.com/docs/reference/js/firebase.database.OnDisconnect#update
|
||||
* @param values
|
||||
* @returns {*}
|
||||
*/
|
||||
update(values: Object) {
|
||||
return promisify('onDisconnectUpdate', FirebaseDatabase)(this.path, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* @url https://firebase.google.com/docs/reference/js/firebase.database.OnDisconnect#remove
|
||||
* @returns {*}
|
||||
*/
|
||||
remove() {
|
||||
return promisify('onDisconnectRemove', FirebaseDatabase)(this.path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @url https://firebase.google.com/docs/reference/js/firebase.database.OnDisconnect#cancel
|
||||
* @returns {*}
|
||||
*/
|
||||
cancel() {
|
||||
return promisify('onDisconnectCancel', FirebaseDatabase)(this.path);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user