2
0
mirror of synced 2025-01-23 04:39:49 +00:00

database.onDisconnect class - js

This commit is contained in:
Salakar 2017-02-14 15:57:08 +00:00
parent 081adee1dc
commit 3601a85e15

View 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);
}
}