Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit ea7718e

Browse files
enhancements and doc for #18 and #20
1 parent cb1888a commit ea7718e

File tree

5 files changed

+31
-9
lines changed

5 files changed

+31
-9
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ This function will store a JSON object at path `<Firebase URL>/users/<Generated
9191
'number': 123
9292
}
9393
}
94+
}).then(
95+
function (result) {
96+
console.log("created key: " + result.key);
97+
}
9498
);
9599
```
96100

@@ -226,10 +230,10 @@ You can expect more login mechanisms to be added in the future.
226230
227231
password: 'firebase'
228232
}).then(
229-
function (uid) {
233+
function (result) {
230234
dialogs.alert({
231235
title: "User created",
232-
message: "uid: " + uid,
236+
message: "userid: " + result.key,
233237
okButtonText: "Nice!"
234238
})
235239
},

firebase.android.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ firebase.createUser = function (arg) {
140140
var valueResultHandler = new com.firebase.client.Firebase.ValueResultHandler({
141141
onSuccess: function (authData) {
142142
console.log("--- created: " + authData);
143-
resolve(firebase.toJsObject(authData).uid);
143+
resolve({
144+
key: firebase.toJsObject(authData).uid
145+
});
144146
},
145147
onError: function (firebaseError) {
146148
reject(firebaseError.getMessage());

firebase.d.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@ declare module "nativescript-plugin-firebase" {
7171
token: string;
7272
}
7373

74+
/**
75+
* The returned object from the push function.
76+
*/
77+
export interface PushResult {
78+
key: string;
79+
}
80+
81+
/**
82+
* The returned object from the createUser function.
83+
*/
84+
export interface CreateUserResult {
85+
key: string;
86+
}
87+
7488
/**
7589
* The options object passed into the createUser function.
7690
*/
@@ -89,10 +103,10 @@ declare module "nativescript-plugin-firebase" {
89103
value: any;
90104
}
91105

92-
export function init(options : InitOptions): Promise<any>;
93-
export function login(options : LoginOptions): Promise<LoginResult>;
94-
export function createUser(options: CreateUserOptions): Promise<any>;
95-
export function push(path: string, value: any): Promise<any>;
106+
export function init(options: InitOptions): Promise<any>;
107+
export function login(options: LoginOptions): Promise<LoginResult>;
108+
export function createUser(options: CreateUserOptions): Promise<CreateUserResult>;
109+
export function push(path: string, value: any): Promise<PushResult>;
96110
export function setValue(path: string, value: any): Promise<any>;
97111
export function remove(path: string): Promise<any>;
98112
export function query(onValueEvent: (data: FBData) => void, path: string, options: QueryOptions): Promise<any>;

firebase.ios.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ firebase.createUser = function (arg) {
107107
if (error) {
108108
reject(error.localizedDescription);
109109
} else {
110-
resolve(firebase.toJsObject(authData).uid);
110+
resolve({
111+
key: firebase.toJsObject(authData).uid
112+
});
111113
}
112114
};
113115

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-plugin-firebase",
3-
"version": "2.0.1",
3+
"version": "2.1.0",
44
"description" : "Fire. Base. Firebase!",
55
"main" : "firebase.js",
66
"nativescript": {

0 commit comments

Comments
 (0)