WordPress.org

Make WordPress Core

Changeset 43355


Ignore:
Timestamp:
06/16/2018 10:28:56 AM (3 years ago)
Author:
atimmer
Message:

Docs: Improve JSDoc for auth-check.js.

Props pskli.
Fixes #44364.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/lib/auth-check.js

    r43347 r43355  
    99    var wrap, next;
    1010
     11    /**
     12     * Shows the authentication form popup.
     13     *
     14     * @since 3.6.0
     15     * @private
     16     */
    1117    function show() {
    1218        var parent = $('#wp-auth-check'),
     
    1622
    1723        if ( form.length ) {
    18             // Add unload confirmation to counter (frame-busting) JS redirects
     24            // Add unload confirmation to counter (frame-busting) JS redirects.
    1925            $(window).on( 'beforeunload.wp-auth-check', function(e) {
    2026                e.originalEvent.returnValue = window.authcheckL10n.beforeunload;
     
    4652                        parent.css( 'max-height', height + 40 + 'px' );
    4753                } else if ( ! body || ! body.length ) {
    48                     // Catch "silent" iframe origin exceptions in WebKit after another page is loaded in the iframe
     54                    // Catch "silent" iframe origin exceptions in WebKit after another page is
     55                    // loaded in the iframe.
    4956                    wrap.addClass('fallback');
    5057                    parent.css( 'max-height', '' );
     
    6269        if ( frame ) {
    6370            frame.focus();
    64             // WebKit doesn't throw an error if the iframe fails to load because of "X-Frame-Options: DENY" header.
     71            // WebKit doesn't throw an error if the iframe fails to load because of
     72            // "X-Frame-Options: DENY" header.
    6573            // Wait for 10 sec. and switch to the fallback text.
    6674            setTimeout( function() {
     
    7684    }
    7785
     86    /**
     87     * Hides the authentication form popup.
     88     *
     89     * @since 3.6.0
     90     * @private
     91     */
    7892    function hide() {
    7993        $(window).off( 'beforeunload.wp-auth-check' );
    8094
    81         // When on the Edit Post screen, speed up heartbeat after the user logs in to quickly refresh nonces
     95        // When on the Edit Post screen, speed up heartbeat after the user logs in to
     96        // quickly refresh nonces.
    8297        if ( typeof adminpage !== 'undefined' && ( adminpage === 'post-php' || adminpage === 'post-new-php' ) &&
    8398            typeof wp !== 'undefined' && wp.heartbeat ) {
     
    94109    }
    95110
     111    /**
     112     * Schedules when the next time the authentication check will be done.
     113     *
     114     * @since 3.6.0
     115     * @private
     116     */
    96117    function schedule() {
    97         var interval = parseInt( window.authcheckL10n.interval, 10 ) || 180; // in seconds, default 3 min.
     118        // In seconds, default 3 min.
     119        var interval = parseInt( window.authcheckL10n.interval, 10 ) || 180;
    98120        next = ( new Date() ).getTime() + ( interval * 1000 );
    99121    }
    100122
     123    /**
     124     * Binds to the Heartbeat Tick event.
     125     *
     126     * - Shows the authentication form popup if user is not logged in.
     127     * - Hides the authentication form popup if it is already visible and user is
     128     *   logged in.
     129     *
     130     * @ignore
     131     *
     132     * @since 3.6.0
     133     *
     134     * @param {Object} e The heartbeat-tick event that has been triggered.
     135     * @param {Object} data Response data.
     136     */
    101137    $( document ).on( 'heartbeat-tick.wp-auth-check', function( e, data ) {
    102138        if ( 'wp-auth-check' in data ) {
     
    108144            }
    109145        }
     146
     147    /**
     148     * Binds to the Heartbeat Send event.
     149     *
     150     * @ignore
     151     *
     152     * @since 3.6.0
     153     *
     154     * @param {Object} e The heartbeat-send event that has been triggered.
     155     * @param {Object} data Response data.
     156     */
    110157    }).on( 'heartbeat-send.wp-auth-check', function( e, data ) {
    111158        if ( ( new Date() ).getTime() > next ) {
    112159            data['wp-auth-check'] = true;
    113160        }
     161
    114162    }).ready( function() {
    115163        schedule();
     164
     165        /**
     166         * Hides the authentication form popup when the close icon is clicked.
     167         *
     168         * @ignore
     169         *
     170         * @since 3.6.0
     171         */
    116172        wrap = $('#wp-auth-check-wrap');
    117173        wrap.find('.wp-auth-check-close').on( 'click', function() {
Note: See TracChangeset for help on using the changeset viewer.