File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -129,9 +129,12 @@ module.exports = function(AV) {
129129 * Set whether to enable fetchWhenSave option when updating object.
130130 * When set true, SDK would fetch the latest object after saving.
131131 * Default is false.
132+ *
133+ * @deprecated use AV.Object#save with options.fetchWhenSave instead
132134 * @param {boolean } enable true to enable fetchWhenSave option.
133135 */
134136 fetchWhenSave : function ( enable ) {
137+ console . warn ( 'AV.Object#fetchWhenSave is deprecated, use AV.Object#save with options.fetchWhenSave instead.' ) ;
135138 if ( ! _ . isBoolean ( enable ) ) {
136139 throw "Expect boolean value for fetchWhenSave" ;
137140 }
Original file line number Diff line number Diff line change @@ -313,9 +313,10 @@ describe('Objects', function(){
313313 person2 . set ( 'age' , 0 ) ;
314314 person2 . increment ( 'age' , 9 ) ;
315315 person2 . save ( ) . then ( function ( person ) {
316- person . fetchWhenSave ( true ) ;
317316 person . increment ( 'age' , 10 ) ;
318- person . save ( ) . then ( function ( p ) {
317+ person . save ( null , {
318+ fetchWhenSave : true
319+ } ) . then ( function ( p ) {
319320 expect ( p . get ( 'age' ) ) . to . be ( 19 ) ;
320321 done ( ) ;
321322 } , function ( err ) {
@@ -328,9 +329,10 @@ describe('Objects', function(){
328329
329330 it ( "should fetch when save when creating new object." , function ( done ) {
330331 var p = new Person ( ) ;
331- p . fetchWhenSave ( true ) ;
332332 p . set ( 'pname' , 'dennis' ) ;
333- p . save ( ) . then ( function ( person ) {
333+ p . save ( null , {
334+ fetchWhenSave : true
335+ } ) . then ( function ( person ) {
334336 expect ( person . get ( 'company' ) ) . to . be ( 'leancloud' ) ;
335337 done ( ) ;
336338 } ) . catch ( function ( err ) {
You can’t perform that action at this time.
0 commit comments