Parse.Object set and save methods can receive a object as parameter

This commit is contained in:
Flavio Torres
2018-01-09 09:04:19 -02:00
parent 538881fcf6
commit 26d39cd9cf
2 changed files with 13 additions and 4 deletions
+5 -3
View File
@@ -98,11 +98,11 @@ declare namespace Parse {
reject(error: any): void;
resolve(result: any): void;
then<U>(resolvedCallback: (...values: T[]) => IPromise<U>,
rejectedCallback?: (reason: any) => IPromise<U>): IPromise<U>;
rejectedCallback?: (reason: any) => IPromise<U>): IPromise<U>;
then<U>(resolvedCallback: (...values: T[]) => U,
rejectedCallback?: (reason: any) => IPromise<U>): IPromise<U>;
rejectedCallback?: (reason: any) => IPromise<U>): IPromise<U>;
then<U>(resolvedCallback: (...values: T[]) => U,
rejectedCallback?: (reason: any) => U): IPromise<U>;
rejectedCallback?: (reason: any) => U): IPromise<U>;
}
interface Pointer {
@@ -373,7 +373,9 @@ declare namespace Parse {
remove(attr: string, item: any): any;
save(attrs?: { [key: string]: any } | null, options?: Object.SaveOptions): Promise<this>;
save(key: string, value: any, options?: Object.SaveOptions): Promise<this>;
save(attrs: object, options?: Object.SaveOptions): Promise<this>;
set(key: string, value: any, options?: Object.SetOptions): boolean;
set(attrs: object, options?: Object.SetOptions): boolean;
setACL(acl: ACL, options?: SuccessFailureOptions): boolean;
toPointer(): Pointer;
unset(attr: string, options?: any): any;
+8 -1
View File
@@ -57,6 +57,12 @@ function test_object() {
gameScore.set("cheatMode", false);
// Setting attrs using object
gameScore.set({
level: '10',
difficult: 15
});
const score = gameScore.get("score");
const playerName = gameScore.get("playerName");
const cheatMode = gameScore.get("cheatMode");
@@ -274,6 +280,7 @@ function test_user_acl_roles() {
game.setACL(new Parse.ACL(Parse.User.current()));
game.save().then((game: Game) => { });
game.save(null, { useMasterKey: true });
game.save({ score: '10' }, { useMasterKey: true });
const groupACL = new Parse.ACL();
@@ -366,7 +373,7 @@ function test_cloud_functions() {
});
Parse.Cloud.beforeDelete('MyCustomClass', (request: Parse.Cloud.BeforeDeleteRequest,
response: Parse.Cloud.BeforeDeleteResponse) => {
response: Parse.Cloud.BeforeDeleteResponse) => {
// result
});