From 8fac5ea0fb25f88c4ed4000c930d7641385ecfed Mon Sep 17 00:00:00 2001 From: Eddy Verbruggen Date: Sat, 9 Apr 2016 21:51:24 +0200 Subject: [PATCH] Added TypeScript definition for the update feature --- firebase.android.js | 18 +++++++++--------- firebase.d.ts | 1 + 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/firebase.android.js b/firebase.android.js index 3cfae69e..19b8db3a 100755 --- a/firebase.android.js +++ b/firebase.android.js @@ -278,15 +278,15 @@ firebase.setValue = function (path, val) { }; firebase.update = function (path, val) { - return new Promise(function (resolve, reject) { - try { - instance.child(path).updateChildren(firebase.toHashMap(val)); - resolve(); - } catch (ex) { - console.log("Error in firebase.update: " + ex); - reject(ex); - } - }); + return new Promise(function (resolve, reject) { + try { + instance.child(path).updateChildren(firebase.toHashMap(val)); + resolve(); + } catch (ex) { + console.log("Error in firebase.update: " + ex); + reject(ex); + } + }); }; firebase.query = function (updateCallback, path, options) { diff --git a/firebase.d.ts b/firebase.d.ts index 5fb3e8cd..a77fa1ae 100644 --- a/firebase.d.ts +++ b/firebase.d.ts @@ -116,6 +116,7 @@ declare module "nativescript-plugin-firebase" { export function resetPassword(options: ResetPasswordOptions): Promise; export function push(path: string, value: any): Promise; export function setValue(path: string, value: any): Promise; + export function update(path: string, value: any): Promise; export function remove(path: string): Promise; export function query(onValueEvent: (data: FBData) => void, path: string, options: QueryOptions): Promise; export function addChildEventListener(onChildEvent: (data: FBData) => void, path: string): Promise;