Make WordPress Core

Changeset 42996


Ignore:
Timestamp:
04/22/2018 02:36:23 PM (5 years ago)
Author:
atimmer
Message:

Docs: Improve JSDoc for wp-includes/js/wp-backbone.js.

Changes some additional docs after [42993].

Props birgire, adamsilverstein, netweb.
Fixes #35465.

File:
1 edited

Legend:

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

    r42993 r42996  
    2121     *
    2222     * @param  {wp.Backbone.View} view  The main view.
    23      * @param  {array|Object}     views The subviews for the main view.
     23     * @param  {Array|Object}     views The subviews for the main view.
    2424     */
    2525    wp.Backbone.Subviews = function( view, views ) {
     
    3636         * @since 3.5.0
    3737         *
    38          * @return {array} All the subviews.
     38         * @return {Array} All the subviews.
    3939         */
    4040        all: function() {
     
    5252         * @param {string} selector A jQuery selector.
    5353         *
    54          * @return {array}
     54         * @return {Array} All the subviews that match the selector.
    5555         */
    5656        get: function( selector ) {
     
    9292         * resulting behavior.
    9393         *
    94          * `options.silent` – *boolean, `false`*
    95          * > If `options.silent` is true, no DOM modifications will be made.
    96          *
    97          * `options.add` – *boolean, `false`*
    98          * > Use `Views.add()` as a shortcut for setting `options.add` to true.
    99          *
    100          * > By default, the provided `views` will replace
    101          * any existing views associated with the selector. If `options.add`
    102          * is true, the provided `views` will be added to the existing views.
    103          *
    104          * `options.at` – *integer, `undefined`*
    105          * > When adding, to insert `views` at a specific index, use
    106          * `options.at`. By default, `views` are added to the end of the array.
     94         * `options.silent` - *boolean, `false`*
     95         * If `options.silent` is true, no DOM modifications will be made.
     96         *
     97         * `options.add` - *boolean, `false`*
     98         * Use `Views.add()` as a shortcut for setting `options.add` to true.
     99         *
     100         * By default, the provided `views` will replace any existing views
     101         * associated with the selector. If `options.add` is true, the provided
     102         * `views` will be added to the existing views.
     103         *
     104         * `options.at` - *integer, `undefined`*
     105         * When adding, to insert `views` at a specific index, use `options.at`.
     106         * By default, `views` are added to the end of the array.
    107107         *
    108108         * @since 3.5.0
    109109         *
    110110         * @param {string}       selector A jQuery selector.
    111          * @param {array|Object} views    The subviews for the main view.
     111         * @param {Array|Object} views    The subviews for the main view.
    112112         * @param {Object}       options  Options for call. If `options.silent` is true,
    113113         *                                no DOM  modifications will be made. Use
     
    118118         *                                `views` at a specific index, use `options.at`.
    119119         *
    120          * @return wp.Backbone.Subviews
     120         * @return {wp.Backbone.Subviews} The current Subviews instance.
    121121         */
    122122        set: function( selector, views, options ) {
     
    198198         *
    199199         * @param {string}       selector A jQuery selector.
    200          * @param {array|object} views    The subviews for the main view.
     200         * @param {Array|Object} views    The subviews for the main view.
    201201         * @param {Object}       options  Options for call.  To insert `views` at a
    202202         *                                specific index, use `options.at`. If
     
    204204         *                                will be made.
    205205         *
    206          * @return wp.Backbone.Subviews
     206         * @return {wp.Backbone.Subviews} The current subviews instance.
    207207         */
    208208        add: function( selector, views, options ) {
     
    229229         *
    230230         * @param {string}       selector A jQuery selector.
    231          * @param {array|object} views    The subviews for the main view.
     231         * @param {Array|Object} views    The subviews for the main view.
    232232         * @param {Object}       options  Options for call. If `options.silent` is set,
    233233         *                                `remove` will *not* be triggered on the
     
    274274
    275275        /**
    276          * Renders all subviews
     276         * Renders all subviews.
    277277         *
    278278         * Used in conjunction with `Views.detach()`.
     
    296296
    297297        /**
    298          * Removes all subviews
     298         * Removes all subviews.
    299299         *
    300300         * Triggers the `remove()` method on all subviews. Detaches the master
     
    345345
    346346        /**
    347          * Insert subviews into a selector
     347         * Insert subviews into a selector.
    348348         *
    349349         * By default, appends the subview `els` to the end of the `$target`
     
    405405         * @private
    406406         *
    407          * @param {string}       selector A jQuery selector.
    408          * @param {array|object} views    The subviews for the main view.
    409          * @param {Object}       options  Options for call.
    410          * @param {boolean}      options.add  If true the provided views will be added.
     407         * @param {string}       selector    A jQuery selector.
     408         * @param {Array|Object} views       The subviews for the main view.
     409         * @param {Object}       options     Options for call.
     410         * @param {boolean}      options.add If true the provided views will be added.
    411411         *
    412412         * @return {wp.Backbone.Subviews} The current Subviews instance.
     
    434434            this[ options.add ? 'insert' : 'replace' ]( $selector, _.pluck( views, 'el' ), options );
    435435
    436             // Set attached and trigger ready if the current view is already
    437             // attached to the DOM.
     436            /*
     437             * Set attached and trigger ready if the current view is already
     438             * attached to the DOM.
     439             */
    438440            _.each( managers, function( manager ) {
    439441                manager.attached = true;
     
    453455         * @private
    454456         *
    455          * @returns {boolean} Whether or not the current view is in the DOM.
     457         * @return {boolean} Whether or not the current view is in the DOM.
    456458         */
    457459        _isReady: function() {
     
    481483         * @since 3.6.0 Moved wp.media.View to wp.Backbone.View
    482484         *
    483          * @memberOf wp.Backbone
    484          *
    485485         * @constructs
    486486         * @augments Backbone.View
     487         *
     488         * @memberOf wp.Backbone
     489         *
    487490         *
    488491         * @param {Object} options The options for this view.
     
    498501
    499502        /**
    500          * @since 3.5.0
    501          *
    502503         * Removes this view and all subviews.
     504         *
     505         * @since 3.5.0
     506         *
     507         * @return {wp.Backbone.Subviews} The current Subviews instance.
    503508         */
    504509        remove: function() {
     
    517522         * @since 3.5.0
    518523         *
    519          * @returns {wp.Backbone.View} The current instance of the view.
     524         * @return {wp.Backbone.View} The current instance of the view.
    520525         */
    521526        render: function() {
     
    542547         * @since 3.5.0
    543548         *
    544          * @returns {Object} The options for this view.
     549         * @return {Object} The options for this view.
    545550         */
    546551        prepare: function() {
Note: See TracChangeset for help on using the changeset viewer.