Commit b813b42439 for wordpress.org
commit b813b4243981ccccda2a3f52d45f648d2f88ed7b
Author: afercia <afercia@git.wordpress.org>
Date: Tue Sep 22 07:36:48 2026 +0000
General: Better documentation for the sync functions in the wp api.js file.
Amends [63766]. Better document the options param and return tag for the `sync` functions in `src/js/_enqueues/wp/api.js`.
Part of the effort to improve JS inline documentation for 7.2.
Developed in https://github.com/WordPress/wordpress-develop/pull/13650
Props westonruter, afercia.
See #66033.
Built from https://develop.svn.wordpress.org/trunk@63791
git-svn-id: http://core.svn.wordpress.org/trunk@62963 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/js/wp-api.js b/wp-includes/js/wp-api.js
index 4584d0f8b1..7f89de8830 100644
--- a/wp-includes/js/wp-api.js
+++ b/wp-includes/js/wp-api.js
@@ -866,12 +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.
- * @return {*}.
+ * @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 {JQuery.Promise} A promise that resolves when the sync operation completes.
*/
sync: function( method, model, options ) {
var beforeSend;
@@ -1027,14 +1029,18 @@
},
/**
- * 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.
- * @param {Object} options Additional options for the sync.
- * @return {*}.
+ * @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 {JQuery.Promise} A promise that resolves when the sync operation completes.
*/
sync: function( method, model, options ) {
var beforeSend, success,
diff --git a/wp-includes/version.php b/wp-includes/version.php
index a59dfdd6e0..cef5754c02 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-alpha-63790';
+$wp_version = '7.2-alpha-63791';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.