From 77c135e06f4742ab8303089bc65eef3b88b175fc Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Mon, 21 Sep 2026 21:40:58 +0200 Subject: [PATCH 1/2] Improve options params in wp api.js file. --- src/js/_enqueues/wp/api.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/js/_enqueues/wp/api.js b/src/js/_enqueues/wp/api.js index 4584d0f8b17d6..7d6c79bc33e53 100644 --- a/src/js/_enqueues/wp/api.js +++ b/src/js/_enqueues/wp/api.js @@ -868,9 +868,11 @@ /** * Set nonce header before every Backbone sync. * - * @param {string} method The CRUD method ("create", "read", "update", or "delete") to be performed. - * @param {Backbone.Model} model The model to be synced. - * @param {Object} options Additional options for the sync. + * @param {string} method The CRUD method ("create", "read", "update", or "delete") to be performed. + * @param {Backbone.Model} model The model to be synced. + * @param {Object} options Additional options for the sync. + * @param {Function} [options.beforeSend] A function to be called before sending the request. + * @param {Function} [options.complete] A function to be called when the request completes. * @return {*}. */ sync: function( method, model, options ) { @@ -1031,9 +1033,13 @@ * * Set nonce header before every Backbone sync. * - * @param {string} method The CRUD method ("create", "read", "update", or "delete") to be performed. - * @param {Backbone.Model} model The model to be synced. - * @param {Object} options Additional options for the sync. + * @param {string} method The CRUD method ("create", "read", "update", or "delete") to be performed. + * @param {Backbone.Model} model The model to be synced. + * @param {Object} options Additional options for the sync. + * @param {Function} [options.beforeSend] A function to be called before sending the request. + * @param {Function} [options.success] A function to be called when the request succeeds. + * @param {Function} [options.complete] A function to be called when the request completes, regardless of success or failure. + * @param {Object} [options.data] Data to be sent with the request. * @return {*}. */ sync: function( method, model, options ) { From 1fb723fe9f6fd51117256112b4d60af063b93af4 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Tue, 22 Sep 2026 09:01:33 +0200 Subject: [PATCH 2/2] Improve documentation of sync functions in wp api.js file. --- src/js/_enqueues/wp/api.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/js/_enqueues/wp/api.js b/src/js/_enqueues/wp/api.js index 7d6c79bc33e53..7f89de8830d1a 100644 --- a/src/js/_enqueues/wp/api.js +++ b/src/js/_enqueues/wp/api.js @@ -866,14 +866,14 @@ }, /** - * Set nonce header before every Backbone sync. + * Sets a nonce header before every Backbone sync. * * @param {string} method The CRUD method ("create", "read", "update", or "delete") to be performed. * @param {Backbone.Model} model The model to be synced. * @param {Object} options Additional options for the sync. * @param {Function} [options.beforeSend] A function to be called before sending the request. * @param {Function} [options.complete] A function to be called when the request completes. - * @return {*}. + * @return {JQuery.Promise} A promise that resolves when the sync operation completes. */ sync: function( method, model, options ) { var beforeSend; @@ -1029,9 +1029,9 @@ }, /** - * Extend Backbone.Collection.sync to add nonce and pagination support. + * Extends Backbone.Collection.sync to add nonce and pagination support. * - * Set nonce header before every Backbone sync. + * Sets a nonce header before every Backbone sync. * * @param {string} method The CRUD method ("create", "read", "update", or "delete") to be performed. * @param {Backbone.Model} model The model to be synced. @@ -1040,7 +1040,7 @@ * @param {Function} [options.success] A function to be called when the request succeeds. * @param {Function} [options.complete] A function to be called when the request completes, regardless of success or failure. * @param {Object} [options.data] Data to be sent with the request. - * @return {*}. + * @return {JQuery.Promise} A promise that resolves when the sync operation completes. */ sync: function( method, model, options ) { var beforeSend, success,