Submitted by
Dmitro
on
Here we extend system Drupal.Ajax.prototype.beforeSend() method. We set progress variable according to data attribute.
let ajaxBeforeSendOriginal = Drupal.Ajax.prototype.beforeSend;
// Extend Drupal.Ajax.prototype.beforeSend.
Drupal.Ajax.prototype.beforeSend = function (xmlhttprequest, options) {
// Set progress variable according to data attribute.
this.progress.type = $(this.element).data("ajax-progress") ||
this.progress.type; ajaxBeforeSendOriginal.call(this, xmlhttprequest, options);
};