Skip to content

Unconditional Delivery Listeners

The where clause argument in the addCreateListener method is optional. When it is not provided, the real-time database will deliver any new object created in the database's table:

const orderEventHandler = Backendless.Data.of( 'Order' ).rt();

const onObjectCreate = object => 
                       console.log( 'New Order object has been created. Object Id - ', object.objectId );

const onError = error => 
                console.log( 'Server reported an error', error );

orderEventHandler.addCreateListener( onObjectCreate, onError );
function Order() {
  this.objectId = undefined;
  this.orderAmount = 0;
}

const orderEventHandler = Backendless.Data.of( Order ).rt();

const onObjectCreate = object => 
                       console.log( 'New Order object has been created. Object Id - ', object.objectId );

const onError = error => 
                console.log( 'Server reported an error', error );

orderEventHandler.addCreateListener( onObjectCreate, onError );