Skip to content

Commit 77df264

Browse files
committed
Missed a few places to update to the new argument structure.
1 parent 2c5773e commit 77df264

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/simperium/bucket.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ Bucket.prototype.reload = function() {
215215
*/
216216
Bucket.prototype.add = function( data, callback ) {
217217
var id = uuid();
218-
return this.update( { id, data }, callback );
218+
return this.update( id, data, callback );
219219
};
220220

221221
/**
@@ -245,8 +245,11 @@ Bucket.prototype.get = function( id, callback ) {
245245
*/
246246
Bucket.prototype.update = function( id, data, updateInfo, options, callback ) {
247247
// Callback could be 3rd or 4th argument
248-
if ( typeof updateInfo === 'function' || typeof options === 'function' ) {
249-
callback = typeof updateInfo === 'function' ? updateInfo : options;
248+
if ( typeof updateInfo === 'function' ) {
249+
callback = updateInfo;
250+
options = { sync: true };
251+
} else if ( typeof options === 'function' ) {
252+
callback = options;
250253
options = { sync: true };
251254
}
252255

@@ -308,7 +311,7 @@ Bucket.prototype.getVersion = function( id, callback ) {
308311
*/
309312
Bucket.prototype.touch = function( id, callback ) {
310313
const task = this.storeAPI.get( id )
311-
.then( object => this.update( { id: object.id, data: object.data } ) );
314+
.then( object => this.update( object.id, object.data ) );
312315

313316
return deprecateCallback( callback, task );
314317
};

0 commit comments

Comments
 (0)