Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

Events in the Backend Services JavaScript SDK

The Backend Services JavaScript SDK allows you to hook to a set of events to check for certain conditions and make changes to your queries.

The events it provides include:

beforeExecute

The beforeExecute event allows you to run additional logic before invoking a operation, for example to make a different request under certain conditions.

The following example uses beforeExecute to add a custom header to all read operations involving the Activities content type that are not synchronization related:

var el = new Everlive('your-app-id');
el.on('beforeExecute', function(eventQuery) {
    eventQuery.filter = {}; //some filter expression
    if (eventQuery.contentTypeName === 'Activities' && eventQuery.operation === Everlive.Constants.DataQueryOperation.Read && !eventQuery.isSync) {
        eventQuery.headers = {'x-custom-header': 'custom header value'};
    } else {
        eventQuery.cancel();
    }
});

syncStart

To learn more about this Offline Support-related event, see Offline Data Synchronization.

syncEnd

To learn more about this Offline Support-related event, see Offline Data Synchronization.

See Also

Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.