mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-24 04:24:52 +08:00
[js][database] fix OnDisconnect incorrectly being constructed + added misc typings
This commit is contained in:
@@ -14,10 +14,12 @@ export default class Disconnect {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param path Reference Path
|
||||
* @param ref
|
||||
*/
|
||||
constructor(path: string) {
|
||||
this.path = path;
|
||||
constructor(ref: Reference) {
|
||||
this.ref = ref;
|
||||
this.path = ref.path;
|
||||
this._database = ref._database;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -25,8 +27,8 @@ export default class Disconnect {
|
||||
* @param value
|
||||
* @returns {*}
|
||||
*/
|
||||
set(value: string | Object) {
|
||||
return this.database._native.onDisconnectSet(this.path, { type: typeOf(value), value });
|
||||
set(value: string | Object): Promise<void> {
|
||||
return this._database._native.onDisconnectSet(this.path, { type: typeOf(value), value });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,23 +36,23 @@ export default class Disconnect {
|
||||
* @param values
|
||||
* @returns {*}
|
||||
*/
|
||||
update(values: Object) {
|
||||
return this.database._native.onDisconnectUpdate(this.path, values);
|
||||
update(values: Object): Promise<void> {
|
||||
return this._database._native.onDisconnectUpdate(this.path, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* @url https://firebase.google.com/docs/reference/js/firebase.database.OnDisconnect#remove
|
||||
* @returns {*}
|
||||
*/
|
||||
remove() {
|
||||
return this.database._native.onDisconnectRemove(this.path);
|
||||
remove(): Promise<void> {
|
||||
return this._database._native.onDisconnectRemove(this.path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @url https://firebase.google.com/docs/reference/js/firebase.database.OnDisconnect#cancel
|
||||
* @returns {*}
|
||||
*/
|
||||
cancel() {
|
||||
return this.database._native.onDisconnectCancel(this.path);
|
||||
cancel(): Promise<void> {
|
||||
return this._database._native.onDisconnectCancel(this.path);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user