Merge pull request #23786 from percypyan/patch-1

Add ParseObject's revert() method in @types/parse
This commit is contained in:
Benjamin Lichtman
2018-03-01 14:50:02 -08:00
committed by GitHub
2 changed files with 8 additions and 1 deletions

View File

@@ -377,6 +377,7 @@ declare namespace Parse {
previousAttributes(): any;
relation(attr: string): Relation<this, Object>;
remove(attr: string, item: any): any;
revert(): void;
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>;

View File

@@ -288,7 +288,13 @@ 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 });
game.save({ score: '10' }, { useMasterKey: true }).then(function (game) {
// Update game then revert it to the last saved state.
game.set("score", '20');
game.revert();
}, function (error) {
// The save failed
});
const groupACL = new Parse.ACL();