Make WordPress Core

Changeset 27031


Ignore:
Timestamp:
01/25/2014 07:38:12 AM (11 years ago)
Author:
wonderboymusic
Message:

Add some JSDoc annotations to media-models.js to disambiguate instance properties and static class properties/methods in the base media Models.

See #26870.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/media-models.js

    r26991 r27031  
    7878         * Fetches a template by id.
    7979         * See wp.template() in `wp-includes/js/wp-util.js`.
     80         *
     81         * @borrows wp.template as template
    8082         */
    8183        template: wp.template,
     
    8688         * Sends a POST request to WordPress.
    8789         * See wp.ajax.post() in `wp-includes/js/wp-util.js`.
     90         *
     91         * @borrows wp.ajax.post as post
    8892         */
    8993        post: wp.ajax.post,
     
    9498         * Sends an XHR request to WordPress.
    9599         * See wp.ajax.send() in `wp-includes/js/wp-util.js`.
     100         *
     101         * @borrows wp.ajax.send as ajax
    96102         */
    97103        ajax: wp.ajax.send,
     
    186192        /**
    187193         * Triggered when attachment details change
     194         * Overrides Backbone.Model.sync
    188195         *
    189196         * @param {string} method
     
    272279         * Convert date strings into Date objects.
    273280         *
    274          * @param {Object} resp
    275          * @returns {Object}
     281         * @param {Object} resp The raw response object, typically returned by fetch()
     282         * @returns {Object} The modified response object, which is the attributes hash
     283         *    to be set on the model.
    276284         */
    277285        parse: function( resp ) {
     
    285293        },
    286294        /**
    287          * @param {Object} data
    288          * @param {Object} options
     295         * @param {Object} data The properties to be saved.
     296         * @param {Object} options Sync options. e.g. patch, wait, success, error.
    289297         *
    290298         * @this Backbone.Model
     
    310318    }, {
    311319        /**
     320         * @static
    312321         * @param {Object} attrs
    313322         * @returns {wp.media.model.Attachment}
     
    317326        },
    318327        /**
     328         * @static
    319329         * @param {string} id
    320330         * @param {Backbone.Model|undefined} attachment
     
    619629        },
    620630        /**
    621          * @param {Object} resp
    622          * @param {XMLHttpRequest} xhr
    623          * @returns {Array}
     631         * Overrides Backbone.Collection.parse
     632         *
     633         * @param {Object|Array} resp The raw response Object/Array.
     634         * @param {Object} xhr
     635         * @returns {Array} The array of model attributes to be added to the collection
    624636         */
    625637        parse: function( resp, xhr ) {
     
    691703    }, {
    692704        /**
     705         * @static
    693706         * @param {Backbone.Model} a
    694707         * @param {Backbone.Model} b
     
    717730            return ( 'DESC' === order ) ? compare( a, b, ac, bc ) : compare( b, a, bc, ac );
    718731        },
    719 
     732        /**
     733         * @namespace
     734         */
    720735        filters: {
    721736            /**
     737             * @static
    722738             * Note that this client-side searching is *not* equivalent
    723739             * to our server-side searching.
    724740             *
    725741             * @param {wp.media.model.Attachment} attachment
     742             *
     743             * @this wp.media.model.Attachments
     744             *
    726745             * @returns {Boolean}
    727746             */
     
    737756            },
    738757            /**
     758             * @static
    739759             * @param {wp.media.model.Attachment} attachment
     760             *
     761             * @this wp.media.model.Attachments
     762             *
    740763             * @returns {Boolean}
    741764             */
     
    745768            },
    746769            /**
     770             * @static
    747771             * @param {wp.media.model.Attachment} attachment
     772             *
     773             * @this wp.media.model.Attachments
     774             *
    748775             * @returns {Boolean}
    749776             */
     
    760787
    761788    /**
     789     * @static
    762790     * @member {wp.media.model.Attachments}
    763791     */
     
    878906        },
    879907        /**
     908         * Overrides Backbone.Collection.sync
     909         * Overrides wp.media.model.Attachments.sync
     910         *
    880911         * @param {String} method
    881912         * @param {Backbone.Model} model
     
    916947        }
    917948    }, {
     949        /**
     950         * @readonly
     951         */
    918952        defaultProps: {
    919953            orderby: 'date',
    920954            order:   'DESC'
    921955        },
    922 
     956        /**
     957         * @readonly
     958         */
    923959        defaultArgs: {
    924960            posts_per_page: 40
    925961        },
    926 
     962        /**
     963         * @readonly
     964         */
    927965        orderby: {
    928966            allowed:  [ 'name', 'author', 'date', 'title', 'modified', 'uploadedTo', 'id', 'post__in', 'menuOrder' ],
     
    933971            }
    934972        },
    935 
     973        /**
     974         * @readonly
     975         */
    936976        propmap: {
    937977            'search':    's',
     
    941981            'uploadedTo': 'post_parent'
    942982        },
    943 
     983        /**
     984         * @static
     985         */
    944986        // Caches query objects so queries can be easily reused.
    945987        get: (function(){
     
    10481090         * selected attachments, reset the selection.
    10491091         *
     1092         * Overrides Backbone.Collection.add
     1093         * Overrides wp.media.model.Attachments.add
     1094         *
    10501095         * @param {Array} models
    10511096         * @param {Object} options
Note: See TracChangeset for help on using the changeset viewer.