
| Current Path : /var/www/html/rocksensor/web/core/modules/system/tests/modules/ajax_test/js/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor/web/core/modules/system/tests/modules/ajax_test/js/command_promise-ajax.js |
/**
* @file
* Testing behavior for the add_js command.
*/
(($, Drupal) => {
/**
* Test Ajax execution Order.
*
* @param {Drupal.Ajax} [ajax]
* {@link Drupal.Ajax} object created by {@link Drupal.Ajax}.
* @param {object} response
* The response from the Ajax request.
* @param {string} response.selector
* A jQuery selector string.
*
* @return {Promise}
* The promise that will resolve once this command has finished executing.
*/
Drupal.AjaxCommands.prototype.ajaxCommandReturnPromise = function (
ajax,
response,
) {
return new Promise((resolve, reject) => {
setTimeout(() => {
this.insert(ajax, response);
resolve();
}, Math.random() * 500);
});
};
})(jQuery, Drupal);