2017-02-14 15:57:08 +00:00
|
|
|
/* @flow */
|
|
|
|
|
2017-07-30 06:34:41 +00:00
|
|
|
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) {
|
2017-07-30 06:34:41 +00:00
|
|
|
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) {
|
2017-07-30 06:34:41 +00:00
|
|
|
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() {
|
2017-07-30 06:34:41 +00:00
|
|
|
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() {
|
2017-07-30 06:34:41 +00:00
|
|
|
return this.database._native.onDisconnectCancel(this.path);
|
2017-02-14 15:57:08 +00:00
|
|
|
}
|
|
|
|
}
|