Make WordPress Core

Changeset 63791


Ignore:
Timestamp:
09/22/2026 07:35:23 AM (less than one hour ago)
Author:
afercia
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/wp/api.js

    r63766 r63791  
    867867
    868868                        /**
    869                          * Set nonce header before every Backbone sync.
     869                         * Sets a nonce header before every Backbone sync.
    870870                         *
    871                          * @param {string}         method  The CRUD method ("create", "read", "update", or "delete") to be performed.
    872                          * @param {Backbone.Model} model   The model to be synced.
    873                          * @param {Object}         options Additional options for the sync.
    874                          * @return {*}.
     871                         * @param {string}         method               The CRUD method ("create", "read", "update", or "delete") to be performed.
     872                         * @param {Backbone.Model} model                The model to be synced.
     873                         * @param {Object}         options              Additional options for the sync.
     874                         * @param {Function}       [options.beforeSend] A function to be called before sending the request.
     875                         * @param {Function}       [options.complete]   A function to be called when the request completes.
     876                         * @return {JQuery.Promise} A promise that resolves when the sync operation completes.
    875877                         */
    876878                        sync: function( method, model, options ) {
     
    10281030
    10291031                        /**
    1030                          * Extend Backbone.Collection.sync to add nonce and pagination support.
     1032                         * Extends Backbone.Collection.sync to add nonce and pagination support.
    10311033                         *
    1032                          * Set nonce header before every Backbone sync.
     1034                         * Sets a nonce header before every Backbone sync.
    10331035                         *
    1034                          * @param {string}         method  The CRUD method ("create", "read", "update", or "delete") to be performed.
    1035                          * @param {Backbone.Model} model   The model to be synced.
    1036                          * @param {Object}         options Additional options for the sync.
    1037                          * @return {*}.
     1036                         * @param {string}         method               The CRUD method ("create", "read", "update", or "delete") to be performed.
     1037                         * @param {Backbone.Model} model                The model to be synced.
     1038                         * @param {Object}         options              Additional options for the sync.
     1039                         * @param {Function}       [options.beforeSend] A function to be called before sending the request.
     1040                         * @param {Function}       [options.success]    A function to be called when the request succeeds.
     1041                         * @param {Function}       [options.complete]   A function to be called when the request completes, regardless of success or failure.
     1042                         * @param {Object}         [options.data]       Data to be sent with the request.
     1043                         * @return {JQuery.Promise} A promise that resolves when the sync operation completes.
    10381044                         */
    10391045                        sync: function( method, model, options ) {
Note: See TracChangeset for help on using the changeset viewer.