@@ -149,8 +149,8 @@ export default function Bucket( name, storeProvider, channel ) {
149149 */
150150 this . onChannelIndex = this . emit . bind ( this , 'index' ) ;
151151 this . onChannelError = this . emit . bind ( this , 'error' ) ;
152- this . onChannelUpdate = ( id , data ) => {
153- this . update ( id , data , { sync : false } ) ;
152+ this . onChannelUpdate = ( id , data , original , patch , isIndexing ) => {
153+ this . update ( id , data , original , patch , isIndexing , { sync : false } ) ;
154154 } ;
155155
156156 this . onChannelIndexingStateChange = ( isIndexing ) => {
@@ -215,7 +215,7 @@ Bucket.prototype.reload = function() {
215215 */
216216Bucket . prototype . add = function ( object , callback ) {
217217 var id = uuid ( ) ;
218- return this . update ( id , object , callback ) ;
218+ return this . update ( id , object , null , null , null , null , callback ) ;
219219} ;
220220
221221/**
@@ -234,12 +234,15 @@ Bucket.prototype.get = function( id, callback ) {
234234 *
235235 * @param {String } id - the bucket id for the object to update
236236 * @param {Object } data - object literal to replace the object data with
237+ * @param {Object } original - the original object before the udpate
238+ * @param {Object } patch - the JSONDiff patch to apply to the object
239+ * @param {Boolean } isIndexing - true if the bucket is currently indexing
237240 * @param {Object } [options] - optional settings
238241 * @param {Boolean } [options.sync=true] - false if object should not be synced with this update
239242 * @param {?bucketStoreGetCallback } callback - executed when object is updated localy
240243 * @returns {Promise<Object> } - update data
241244 */
242- Bucket . prototype . update = function ( id , data , options , callback ) {
245+ Bucket . prototype . update = function ( id , data , original , patch , isIndexing , options , callback ) {
243246 if ( typeof options === 'function' ) {
244247 callback = options ;
245248 options = { sync : true } ;
@@ -251,7 +254,7 @@ Bucket.prototype.update = function( id, data, options, callback ) {
251254
252255 const task = this . storeAPI . update ( id , data , this . isIndexing )
253256 . then ( bucketObject => {
254- this . emit ( 'update' , id , bucketObject . data ) ;
257+ this . emit ( 'update' , id , bucketObject . data , original , patch , isIndexing ) ;
255258 this . channel . update ( bucketObject , options . sync ) ;
256259 return bucketObject ;
257260 } ) ;
0 commit comments