diff --git src/wp-includes/js/heartbeat.js src/wp-includes/js/heartbeat.js
index 0f93ff36d..9db2162ab 100644
|
|
|
27 | 27 | */ |
28 | 28 | |
29 | 29 | ( function( $, window, undefined ) { |
| 30 | |
| 31 | /** |
| 32 | * Constructs the Heartbeat API. |
| 33 | * |
| 34 | * @since 3.6.0 |
| 35 | * |
| 36 | * @returns {Object} An instance of the Heartbeat class. |
| 37 | * @constructor |
| 38 | */ |
30 | 39 | var Heartbeat = function() { |
31 | 40 | var $document = $(document), |
32 | 41 | settings = { |
33 | | // Suspend/resume |
| 42 | // Suspend/resume. |
34 | 43 | suspend: false, |
35 | 44 | |
36 | | // Whether suspending is enabled |
| 45 | // Whether suspending is enabled. |
37 | 46 | suspendEnabled: true, |
38 | 47 | |
39 | | // Current screen id, defaults to the JS global 'pagenow' when present (in the admin) or 'front' |
| 48 | // Current screen id, defaults to the JS global 'pagenow' when present (in the admin) or 'front'. |
40 | 49 | screenId: '', |
41 | 50 | |
42 | | // XHR request URL, defaults to the JS global 'ajaxurl' when present |
| 51 | // XHR request URL, defaults to the JS global 'ajaxurl' when present. |
43 | 52 | url: '', |
44 | 53 | |
45 | | // Timestamp, start of the last connection request |
| 54 | // Timestamp, start of the last connection request. |
46 | 55 | lastTick: 0, |
47 | 56 | |
48 | | // Container for the enqueued items |
| 57 | // Container for the enqueued items. |
49 | 58 | queue: {}, |
50 | 59 | |
51 | | // Connect interval (in seconds) |
| 60 | // Connect interval (in seconds). |
52 | 61 | mainInterval: 60, |
53 | 62 | |
54 | | // Used when the interval is set to 5 sec. temporarily |
| 63 | // Used when the interval is set to 5 sec. temporarily. |
55 | 64 | tempInterval: 0, |
56 | 65 | |
57 | | // Used when the interval is reset |
| 66 | // Used when the interval is reset. |
58 | 67 | originalInterval: 0, |
59 | 68 | |
60 | 69 | // Used to limit the number of AJAX requests. |
61 | 70 | minimalInterval: 0, |
62 | 71 | |
63 | | // Used together with tempInterval |
| 72 | // Used together with tempInterval. |
64 | 73 | countdown: 0, |
65 | 74 | |
66 | | // Whether a connection is currently in progress |
| 75 | // Whether a connection is currently in progress. |
67 | 76 | connecting: false, |
68 | 77 | |
69 | | // Whether a connection error occurred |
| 78 | // Whether a connection error occurred. |
70 | 79 | connectionError: false, |
71 | 80 | |
72 | | // Used to track non-critical errors |
| 81 | // Used to track non-critical errors. |
73 | 82 | errorcount: 0, |
74 | 83 | |
75 | | // Whether at least one connection has completed successfully |
| 84 | // Whether at least one connection has been completed successfully. |
76 | 85 | hasConnected: false, |
77 | 86 | |
78 | | // Whether the current browser window is in focus and the user is active |
| 87 | // Whether the current browser window is in focus and the user is active. |
79 | 88 | hasFocus: true, |
80 | 89 | |
81 | 90 | // Timestamp, last time the user was active. Checked every 30 sec. |
82 | 91 | userActivity: 0, |
83 | 92 | |
84 | | // Flags whether events tracking user activity were set |
| 93 | // Flag whether events tracking user activity were set. |
85 | 94 | userActivityEvents: false, |
86 | 95 | |
| 96 | // Timer that keeps track of how long a user has focus. |
87 | 97 | checkFocusTimer: 0, |
| 98 | |
| 99 | // Timer that keeps track of how long needs to be waited before connecting to the server again. |
88 | 100 | beatTimer: 0 |
89 | 101 | }; |
90 | 102 | |
91 | 103 | /** |
92 | | * Set local vars and events, then start |
| 104 | * Sets the necessary variables and events before starting the actual heartbeat. |
| 105 | * |
| 106 | * @summary Sets local variables and events, then starts the heartbeat. |
93 | 107 | * |
94 | 108 | * @access private |
95 | 109 | * |
96 | | * @return void |
| 110 | * @since 3.8.0 |
| 111 | * |
| 112 | * @returns { void } |
97 | 113 | */ |
98 | 114 | function initialize() { |
99 | 115 | var options, hidden, visibilityState, visibilitychange; |
… |
… |
|
106 | 122 | settings.url = window.ajaxurl; |
107 | 123 | } |
108 | 124 | |
109 | | // Pull in options passed from PHP |
| 125 | // Pull in options passed from PHP. |
110 | 126 | if ( typeof window.heartbeatSettings === 'object' ) { |
111 | 127 | options = window.heartbeatSettings; |
112 | 128 | |
113 | | // The XHR URL can be passed as option when window.ajaxurl is not set |
| 129 | // The XHR URL can be passed as option when window.ajaxurl is not set. |
114 | 130 | if ( ! settings.url && options.ajaxurl ) { |
115 | 131 | settings.url = options.ajaxurl; |
116 | 132 | } |
117 | 133 | |
118 | | // The interval can be from 15 to 120 sec. and can be set temporarily to 5 sec. |
119 | | // It can be set in the initial options or changed later from JS and/or from PHP. |
| 134 | /** |
| 135 | * The interval can be from 15 to 120 sec. and can be set temporarily to 5 sec. |
| 136 | * It can be set in the initial options or changed later through JS and/or through PHP. |
| 137 | */ |
120 | 138 | if ( options.interval ) { |
121 | 139 | settings.mainInterval = options.interval; |
122 | 140 | |
… |
… |
|
127 | 145 | } |
128 | 146 | } |
129 | 147 | |
130 | | // Used to limit the number of AJAX requests. Overrides all other intervals if they are shorter. |
131 | | // Needed for some hosts that cannot handle frequent requests and the user may exceed the allocated server CPU time, etc. |
132 | | // The minimal interval can be up to 600 sec. however setting it to longer than 120 sec. will limit or disable |
133 | | // some of the functionality (like post locks). |
134 | | // Once set at initialization, minimalInterval cannot be changed/overridden. |
| 148 | /** |
| 149 | * Used to limit the number of AJAX requests. Overrides all other intervals if they are shorter. |
| 150 | * Needed for some hosts that cannot handle frequent requests and the user may exceed the allocated server CPU time, etc. |
| 151 | * The minimal interval can be up to 600 sec. however setting it to longer than 120 sec. will limit or disable |
| 152 | * some of the functionality (like post locks). |
| 153 | * Once set at initialization, minimalInterval cannot be changed/overridden. |
| 154 | */ |
135 | 155 | if ( options.minimalInterval ) { |
136 | 156 | options.minimalInterval = parseInt( options.minimalInterval, 10 ); |
137 | 157 | settings.minimalInterval = options.minimalInterval > 0 && options.minimalInterval <= 600 ? options.minimalInterval * 1000 : 0; |
… |
… |
|
141 | 161 | settings.mainInterval = settings.minimalInterval; |
142 | 162 | } |
143 | 163 | |
144 | | // 'screenId' can be added from settings on the front end where the JS global 'pagenow' is not set |
| 164 | // 'screenId' can be added from settings on the front end where the JS global 'pagenow' is not set. |
145 | 165 | if ( ! settings.screenId ) { |
146 | 166 | settings.screenId = options.screenId || 'front'; |
147 | 167 | } |
… |
… |
|
151 | 171 | } |
152 | 172 | } |
153 | 173 | |
154 | | // Convert to milliseconds |
| 174 | // Convert to milliseconds. |
155 | 175 | settings.mainInterval = settings.mainInterval * 1000; |
156 | 176 | settings.originalInterval = settings.mainInterval; |
157 | 177 | |
158 | | // Switch the interval to 120 sec. by using the Page Visibility API. |
159 | | // If the browser doesn't support it (Safari < 7, Android < 4.4, IE < 10), the interval |
160 | | // will be increased to 120 sec. after 5 min. of mouse and keyboard inactivity. |
| 178 | /** |
| 179 | * Switch the interval to 120 seconds by using the Page Visibility API. |
| 180 | * If the browser doesn't support it (Safari < 7, Android < 4.4, IE < 10), the interval |
| 181 | * will be increased to 120 seconds after 5 minutes of mouse and keyboard inactivity. |
| 182 | */ |
161 | 183 | if ( typeof document.hidden !== 'undefined' ) { |
162 | 184 | hidden = 'hidden'; |
163 | 185 | visibilitychange = 'visibilitychange'; |
… |
… |
|
196 | 218 | } |
197 | 219 | |
198 | 220 | $(window).on( 'unload.wp-heartbeat', function() { |
199 | | // Don't connect any more |
| 221 | // Don't connect anymore. |
200 | 222 | settings.suspend = true; |
201 | 223 | |
202 | | // Abort the last request if not completed |
| 224 | // Abort the last request if not completed. |
203 | 225 | if ( settings.xhr && settings.xhr.readyState !== 4 ) { |
204 | 226 | settings.xhr.abort(); |
205 | 227 | } |
… |
… |
|
208 | 230 | // Check for user activity every 30 seconds. |
209 | 231 | window.setInterval( checkUserActivity, 30000 ); |
210 | 232 | |
211 | | // Start one tick after DOM ready |
| 233 | // Start one tick after DOM ready. |
212 | 234 | $document.ready( function() { |
213 | 235 | settings.lastTick = time(); |
214 | 236 | scheduleNextTick(); |
… |
… |
|
216 | 238 | } |
217 | 239 | |
218 | 240 | /** |
219 | | * Return the current time according to the browser |
| 241 | * Returns the current time according to the browser. |
220 | 242 | * |
221 | 243 | * @access private |
222 | 244 | * |
223 | | * @return int |
| 245 | * @since 3.6.0 |
| 246 | * |
| 247 | * @returns int Returns the current time. |
224 | 248 | */ |
225 | 249 | function time() { |
226 | 250 | return (new Date()).getTime(); |
227 | 251 | } |
228 | 252 | |
229 | 253 | /** |
230 | | * Check if the iframe is from the same origin |
| 254 | * Checks if the iframe is from the same origin. |
231 | 255 | * |
232 | 256 | * @access private |
233 | 257 | * |
234 | | * @return bool |
| 258 | * @since 3.6.0 |
| 259 | * |
| 260 | * @returns boolean Returns whether or not the iframe is from the same origin. |
235 | 261 | */ |
236 | 262 | function isLocalFrame( frame ) { |
237 | 263 | var origin, src = frame.src; |
238 | 264 | |
239 | | // Need to compare strings as WebKit doesn't throw JS errors when iframes have different origin. |
240 | | // It throws uncatchable exceptions. |
| 265 | /** |
| 266 | * Need to compare strings as WebKit doesn't throw JS errors when iframes have different origin. |
| 267 | * It throws uncatchable exceptions. |
| 268 | */ |
241 | 269 | if ( src && /^https?:\/\//.test( src ) ) { |
242 | 270 | origin = window.location.origin ? window.location.origin : window.location.protocol + '//' + window.location.host; |
243 | 271 | |
… |
… |
|
256 | 284 | } |
257 | 285 | |
258 | 286 | /** |
259 | | * Check if the document's focus has changed |
| 287 | * Checks if the document's focus has changed. |
260 | 288 | * |
261 | 289 | * @access private |
262 | 290 | * |
263 | | * @return void |
| 291 | * @since 4.1.0 |
| 292 | * |
| 293 | * @returns { void } |
264 | 294 | */ |
265 | 295 | function checkFocus() { |
266 | 296 | if ( settings.hasFocus && ! document.hasFocus() ) { |
… |
… |
|
271 | 301 | } |
272 | 302 | |
273 | 303 | /** |
274 | | * Set error state and fire an event on XHR errors or timeout |
| 304 | * Sets error state and fires an event on XHR errors or timeout. |
275 | 305 | * |
276 | 306 | * @access private |
277 | 307 | * |
278 | | * @param string error The error type passed from the XHR |
279 | | * @param int status The HTTP status code passed from jqXHR (200, 404, 500, etc.) |
280 | | * @return void |
| 308 | * @since 3.8.0 |
| 309 | * |
| 310 | * @param string error The error type passed from the XHR. |
| 311 | * @param int status The HTTP status code passed from jqXHR (200, 404, 500, etc.). |
| 312 | * |
| 313 | * @returns { void } |
281 | 314 | */ |
282 | 315 | function setErrorState( error, status ) { |
283 | 316 | var trigger; |
… |
… |
|
285 | 318 | if ( error ) { |
286 | 319 | switch ( error ) { |
287 | 320 | case 'abort': |
288 | | // do nothing |
| 321 | // Do nothing. |
289 | 322 | break; |
290 | 323 | case 'timeout': |
291 | | // no response for 30 sec. |
| 324 | // No response for 30 sec. |
292 | 325 | trigger = true; |
293 | 326 | break; |
294 | 327 | case 'error': |
… |
… |
|
296 | 329 | trigger = true; |
297 | 330 | break; |
298 | 331 | } |
299 | | /* falls through */ |
| 332 | // Falls through. |
300 | 333 | case 'parsererror': |
301 | 334 | case 'empty': |
302 | 335 | case 'unknown': |
… |
… |
|
317 | 350 | } |
318 | 351 | |
319 | 352 | /** |
320 | | * Clear the error state and fire an event |
| 353 | * Clears the error state and fires an event if there is a connection error. |
321 | 354 | * |
322 | 355 | * @access private |
323 | 356 | * |
324 | | * @return void |
| 357 | * @since 3.8.0 |
| 358 | * |
| 359 | * @returns { void } |
325 | 360 | */ |
326 | 361 | function clearErrorState() { |
327 | | // Has connected successfully |
| 362 | // Has connected successfully. |
328 | 363 | settings.hasConnected = true; |
329 | 364 | |
330 | 365 | if ( hasConnectionError() ) { |
… |
… |
|
335 | 370 | } |
336 | 371 | |
337 | 372 | /** |
338 | | * Gather the data and connect to the server |
| 373 | * Gathers the data and connects to the server. |
339 | 374 | * |
340 | 375 | * @access private |
341 | 376 | * |
342 | | * @return void |
| 377 | * @since 3.6.0 |
| 378 | * |
| 379 | * @returns { void } |
343 | 380 | */ |
344 | 381 | function connect() { |
345 | 382 | var ajaxData, heartbeatData; |
… |
… |
|
353 | 390 | settings.lastTick = time(); |
354 | 391 | |
355 | 392 | heartbeatData = $.extend( {}, settings.queue ); |
356 | | // Clear the data queue, anything added after this point will be send on the next tick |
| 393 | // Clear the data queue. Anything added after this point will be sent on the next tick. |
357 | 394 | settings.queue = {}; |
358 | 395 | |
359 | 396 | $document.trigger( 'heartbeat-send', [ heartbeatData ] ); |
… |
… |
|
403 | 440 | |
404 | 441 | $document.trigger( 'heartbeat-tick', [response, textStatus, jqXHR] ); |
405 | 442 | |
406 | | // Do this last, can trigger the next XHR if connection time > 5 sec. and newInterval == 'fast' |
| 443 | // Do this last. Can trigger the next XHR if connection time > 5 sec. and newInterval == 'fast'. |
407 | 444 | if ( newInterval ) { |
408 | 445 | interval( newInterval ); |
409 | 446 | } |
… |
… |
|
414 | 451 | } |
415 | 452 | |
416 | 453 | /** |
417 | | * Schedule the next connection |
| 454 | * Schedules the next connection. |
418 | 455 | * |
419 | 456 | * Fires immediately if the connection time is longer than the interval. |
420 | 457 | * |
421 | 458 | * @access private |
422 | 459 | * |
423 | | * @return void |
| 460 | * @since 3.8.0 |
| 461 | * |
| 462 | * @returns { void } |
424 | 463 | */ |
425 | 464 | function scheduleNextTick() { |
426 | 465 | var delta = time() - settings.lastTick, |
… |
… |
|
460 | 499 | } |
461 | 500 | |
462 | 501 | /** |
463 | | * Set the internal state when the browser window becomes hidden or loses focus |
| 502 | * Sets the internal state when the browser window becomes hidden or loses focus. |
464 | 503 | * |
465 | 504 | * @access private |
466 | 505 | * |
467 | | * @return void |
| 506 | * @since 3.6.0 |
| 507 | * |
| 508 | * @returns { void } |
468 | 509 | */ |
469 | 510 | function blurred() { |
470 | 511 | settings.hasFocus = false; |
471 | 512 | } |
472 | 513 | |
473 | 514 | /** |
474 | | * Set the internal state when the browser window becomes visible or is in focus |
| 515 | * Sets the internal state when the browser window becomes visible or is in focus. |
475 | 516 | * |
476 | 517 | * @access private |
477 | 518 | * |
478 | | * @return void |
| 519 | * @since 3.6.0 |
| 520 | * |
| 521 | * @returns { void } |
479 | 522 | */ |
480 | 523 | function focused() { |
481 | 524 | settings.userActivity = time(); |
… |
… |
|
490 | 533 | } |
491 | 534 | |
492 | 535 | /** |
493 | | * Runs when the user becomes active after a period of inactivity |
| 536 | * Runs when the user becomes active after a period of inactivity. |
494 | 537 | * |
495 | 538 | * @access private |
496 | 539 | * |
497 | | * @return void |
| 540 | * @since 3.6.0 |
| 541 | * |
| 542 | * @returns { void } |
498 | 543 | */ |
499 | 544 | function userIsActive() { |
500 | 545 | settings.userActivityEvents = false; |
… |
… |
|
510 | 555 | } |
511 | 556 | |
512 | 557 | /** |
513 | | * Check for user activity |
| 558 | * Checks for user activity. |
514 | 559 | * |
515 | 560 | * Runs every 30 sec. |
516 | 561 | * Sets 'hasFocus = true' if user is active and the window is in the background. |
517 | | * Set 'hasFocus = false' if the user has been inactive (no mouse or keyboard activity) |
| 562 | * Sets 'hasFocus = false' if the user has been inactive (no mouse or keyboard activity) |
518 | 563 | * for 5 min. even when the window has focus. |
519 | 564 | * |
520 | 565 | * @access private |
521 | 566 | * |
522 | | * @return void |
| 567 | * @since 3.8.0 |
| 568 | * |
| 569 | * @returns { void } |
523 | 570 | */ |
524 | 571 | function checkUserActivity() { |
525 | 572 | var lastActive = settings.userActivity ? time() - settings.userActivity : 0; |
… |
… |
|
552 | 599 | } |
553 | 600 | } |
554 | 601 | |
555 | | // Public methods |
| 602 | // Public methods. |
556 | 603 | |
557 | 604 | /** |
558 | | * Whether the window (or any local iframe in it) has focus, or the user is active |
| 605 | * Checks whether the window (or any local iframe in it) has focus, or the user is active. |
559 | 606 | * |
560 | | * @return bool |
| 607 | * @since 3.6.0 |
| 608 | * |
| 609 | * @returns boolean True if the window or the user is active. |
561 | 610 | */ |
562 | 611 | function hasFocus() { |
563 | 612 | return settings.hasFocus; |
564 | 613 | } |
565 | 614 | |
566 | 615 | /** |
567 | | * Whether there is a connection error |
| 616 | * Checks whether there is a connection error. |
| 617 | * |
| 618 | * @since 3.6.0 |
568 | 619 | * |
569 | | * @return bool |
| 620 | * @returns boolean True if a connection error was found. |
570 | 621 | */ |
571 | 622 | function hasConnectionError() { |
572 | 623 | return settings.connectionError; |
573 | 624 | } |
574 | 625 | |
575 | 626 | /** |
576 | | * Connect asap regardless of 'hasFocus' |
| 627 | * Connects as soon as possible regardless of 'hasFocus' state. |
577 | 628 | * |
578 | 629 | * Will not open two concurrent connections. If a connection is in progress, |
579 | 630 | * will connect again immediately after the current connection completes. |
580 | 631 | * |
581 | | * @return void |
| 632 | * @since 3.8.0 |
| 633 | * |
| 634 | * @returns { void } |
582 | 635 | */ |
583 | 636 | function connectNow() { |
584 | 637 | settings.lastTick = 0; |
… |
… |
|
586 | 639 | } |
587 | 640 | |
588 | 641 | /** |
589 | | * Disable suspending |
| 642 | * Disables suspending. |
590 | 643 | * |
591 | 644 | * Should be used only when Heartbeat is performing critical tasks like autosave, post-locking, etc. |
592 | 645 | * Using this on many screens may overload the user's hosting account if several |
593 | 646 | * browser windows/tabs are left open for a long time. |
594 | 647 | * |
595 | | * @return void |
| 648 | * @since 3.8.0 |
| 649 | * |
| 650 | * @returns { void } |
596 | 651 | */ |
597 | 652 | function disableSuspend() { |
598 | 653 | settings.suspendEnabled = false; |
599 | 654 | } |
600 | 655 | |
601 | 656 | /** |
602 | | * Get/Set the interval |
| 657 | * Gets/Sets the interval. |
603 | 658 | * |
604 | | * When setting to 'fast' or 5, by default interval is 5 sec. for the next 30 ticks (for 2 min and 30 sec). |
| 659 | * When setting to 'fast' or 5, the interval is 5 seconds for the next 30 ticks (for 2 minutes and 30 seconds) by default. |
605 | 660 | * In this case the number of 'ticks' can be passed as second argument. |
606 | 661 | * If the window doesn't have focus, the interval slows down to 2 min. |
607 | 662 | * |
608 | | * @param mixed speed Interval: 'fast' or 5, 15, 30, 60, 120 |
609 | | * @param string ticks Used with speed = 'fast' or 5, how many ticks before the interval reverts back |
610 | | * @return int Current interval in seconds |
| 663 | * @since 3.6.0 |
| 664 | * |
| 665 | * @param mixed speed Interval: 'fast' or 5, 15, 30, 60, 120. |
| 666 | * @param string ticks Used with speed = 'fast' or 5. Tells how many ticks before the interval reverts back. |
| 667 | * |
| 668 | * @returns int Current interval in seconds. |
611 | 669 | */ |
612 | 670 | function interval( speed, ticks ) { |
613 | 671 | var newInterval, |
… |
… |
|
667 | 725 | } |
668 | 726 | |
669 | 727 | /** |
670 | | * Enqueue data to send with the next XHR |
| 728 | * Enqueues data to send with the next XHR. |
671 | 729 | * |
672 | 730 | * As the data is send asynchronously, this function doesn't return the XHR response. |
673 | 731 | * To see the response, use the custom jQuery event 'heartbeat-tick' on the document, example: |
… |
… |
|
677 | 735 | * If the same 'handle' is used more than once, the data is not overwritten when the third argument is 'true'. |
678 | 736 | * Use wp.heartbeat.isQueued('handle') to see if any data is already queued for that handle. |
679 | 737 | * |
680 | | * $param string handle Unique handle for the data. The handle is used in PHP to receive the data. |
681 | | * $param mixed data The data to send. |
682 | | * $param bool noOverwrite Whether to overwrite existing data in the queue. |
683 | | * $return bool Whether the data was queued or not. |
| 738 | * @since 3.6.0 |
| 739 | * |
| 740 | * @param string handle Unique handle for the data, used in PHP to receive the data. |
| 741 | * @param mixed data The data to send. |
| 742 | * @param boolean noOverwrite Whether to overwrite existing data in the queue. |
| 743 | * |
| 744 | * @returns boolean True if the data was queued. |
684 | 745 | */ |
685 | 746 | function enqueue( handle, data, noOverwrite ) { |
686 | 747 | if ( handle ) { |
… |
… |
|
695 | 756 | } |
696 | 757 | |
697 | 758 | /** |
698 | | * Check if data with a particular handle is queued |
| 759 | * Checks if data with a particular handle is queued. |
| 760 | * |
| 761 | * @since 3.6.0 |
| 762 | * |
| 763 | * @param string handle The handle for the data. |
699 | 764 | * |
700 | | * $param string handle The handle for the data |
701 | | * $return bool Whether some data is queued with this handle |
| 765 | * @returns boolean True if the data is queued with this handle. |
702 | 766 | */ |
703 | 767 | function isQueued( handle ) { |
704 | 768 | if ( handle ) { |
… |
… |
|
707 | 771 | } |
708 | 772 | |
709 | 773 | /** |
710 | | * Remove data with a particular handle from the queue |
| 774 | * Removes data with a particular handle from the queue. |
711 | 775 | * |
712 | | * $param string handle The handle for the data |
713 | | * $return void |
| 776 | * @since 3.7.0 |
| 777 | * |
| 778 | * @param string handle The handle for the data. |
| 779 | * |
| 780 | * @returns void |
714 | 781 | */ |
715 | 782 | function dequeue( handle ) { |
716 | 783 | if ( handle ) { |
… |
… |
|
719 | 786 | } |
720 | 787 | |
721 | 788 | /** |
722 | | * Get data that was enqueued with a particular handle |
| 789 | * Gets data that was enqueued with a particular handle. |
| 790 | * |
| 791 | * @since 3.7.0 |
| 792 | * |
| 793 | * @param string handle The handle for the data. |
723 | 794 | * |
724 | | * $param string handle The handle for the data |
725 | | * $return mixed The data or undefined |
| 795 | * @returns mixed The data or undefined. |
726 | 796 | */ |
727 | 797 | function getQueuedItem( handle ) { |
728 | 798 | if ( handle ) { |
… |
… |
|
732 | 802 | |
733 | 803 | initialize(); |
734 | 804 | |
735 | | // Expose public methods |
| 805 | // Expose public methods. |
736 | 806 | return { |
737 | 807 | hasFocus: hasFocus, |
738 | 808 | connectNow: connectNow, |