From 19fb0f1153586d49821f2ab940973a680381eefe Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Sun, 28 Jul 2013 20:54:48 +0000 Subject: [PATCH] Add "experimental" to heartbeat phpdoc, fixes #24855 for trunk. git-svn-id: http://core.svn.wordpress.org/trunk@24818 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/ajax-actions.php | 14 +++++++++++--- wp-includes/js/heartbeat.js | 5 ++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 9e7ec0ce5c..734409fe1f 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -9,6 +9,12 @@ /* * No-privilege Ajax handlers. */ + +/** + * Heartbeat API (experimental) + * + * Runs when the user is not logged in. + */ function wp_ajax_nopriv_heartbeat() { $response = array(); @@ -2052,6 +2058,11 @@ function wp_ajax_send_link_to_editor() { wp_send_json_success( $html ); } +/** + * Heartbeat API (experimental) + * + * Runs when the user is logged in. + */ function wp_ajax_heartbeat() { if ( empty( $_POST['_nonce'] ) ) wp_send_json_error(); @@ -2072,9 +2083,6 @@ function wp_ajax_heartbeat() { if ( ! empty($_POST['data']) ) { $data = (array) $_POST['data']; - - // todo: separate filters: 'heartbeat_[action]' so we call different callbacks only when there is data for them, - // or all callbacks listen to one filter and run when there is something for them in $data? $response = apply_filters( 'heartbeat_received', $response, $data, $screen_id ); } diff --git a/wp-includes/js/heartbeat.js b/wp-includes/js/heartbeat.js index fe89ea4880..d5f38de052 100644 --- a/wp-includes/js/heartbeat.js +++ b/wp-includes/js/heartbeat.js @@ -1,6 +1,10 @@ /** * Heartbeat API * + * Note: this API is "experimental" meaning it will likely change a lot + * in the next few releases based on feedback from 3.6.0. If you intend + * to use it, please follow the development closely. + * * Heartbeat is a simple server polling API that sends XHR requests to * the server every 15 seconds and triggers events (or callbacks) upon * receiving data. Currently these 'ticks' handle transports for post locking, @@ -47,7 +51,6 @@ window.wp = window.wp || {}; * Returns a boolean that's indicative of whether or not there is a connection error * * @returns boolean - * @private */ this.hasConnectionError = function() { return hasConnectionError;