Index: wp-includes/js/heartbeat.js
===================================================================
--- wp-includes/js/heartbeat.js	(revision 24720)
+++ wp-includes/js/heartbeat.js	(working copy)
@@ -40,11 +40,42 @@
 			isUserActive,
 			userActiveEvents,
 			winBlurTimeout,
-			frameBlurTimeout = -1;
+			frameBlurTimeout = -1,
+			shouldAutoStart = true,
+			hasActiveConnection = true;
 
-		this.autostart = true;
-		this.connectionLost = false;
+		/**
+		 * If a value is specified, this function will set the internal value of the `shouldAutoStart` setting. Always
+		 * returns the value of `shouldAutoStart`
+		 *
+		 * @param value
+		 * @returns boolean
+		 * @private
+		 */
+		self.shouldAutoStart = function( value ) {
+			if ( typeof value === 'boolean' ) {
+				return shouldAutoStart = value;
+			}
 
+			return shouldAutoStart;
+		};
+
+		/**
+		 * If a value is specified, this function will set the internal value of the `hasActiveConnection` setting.
+		 * Always returns the value of `hasActiveConnection`
+		 *
+		 * @param value (optional)
+		 * @returns boolean
+		 * @private
+		 */
+		self.hasActiveConnection = function( value ) {
+			if ( typeof value === 'boolean' ) {
+				return hasActiveConnection = value;
+			}
+
+			return hasActiveConnection;
+		};
+
 		if ( typeof( window.heartbeatSettings ) == 'object' ) {
 			settings = $.extend( {}, window.heartbeatSettings );
 
@@ -121,13 +152,13 @@
 						break;
 				}
 
-				if ( trigger && ! self.connectionLost ) {
-					self.connectionLost = true;
+				if ( trigger && self.hasActiveConnection() === true ) {
+					self.hasActiveConnection( false );
 					$(document).trigger( 'heartbeat-connection-lost', [error] );
 				}
-			} else if ( self.connectionLost ) {
+			} else if ( self.hasActiveConnection() === false ) {
 				errorcount = 0;
-				self.connectionLost = false;
+				self.hasActiveConnection( true );
 				$(document).trigger( 'heartbeat-connection-restored' );
 			}
 		}
@@ -152,7 +183,7 @@
 
 			// If nothing to send (nothing is expecting a response),
 			// schedule the next tick and bail
-			if ( empty && ! self.connectionLost ) {
+			if ( empty && self.hasActiveConnection() === true ) {
 				connecting = false;
 				next();
 				return;
@@ -179,7 +210,7 @@
 					return errorstate( 'empty' );
 
 				// Clear error state
-				if ( self.connectionLost )
+				if ( self.hasActiveConnection() === false )
 					errorstate();
 
 				if ( response.nonces_expired ) {
@@ -205,7 +236,7 @@
 				errorstate( textStatus || 'unknown' );
 				self.error( jqXHR, textStatus, error );
 			});
-		};
+		}
 
 		function next() {
 			var delta = time() - tick, t = interval;
@@ -333,7 +364,7 @@
 		// Check for user activity every 30 seconds.
 		window.setInterval( function(){ checkUserActive(); }, 30000 );
 
-		if ( this.autostart ) {
+		if ( self.shouldAutoStart() === true ) {
 			$(document).ready( function() {
 				// Start one tick (15 sec) after DOM ready
 				running = true;
@@ -344,7 +375,7 @@
 
 		this.hasFocus = function() {
 			return hasFocus;
-		}
+		};
 
 		/**
 		 * Get/Set the interval
@@ -420,7 +451,7 @@
 			errorstate();
 			running = false;
 			return true;
-		}
+		};
 
 		/**
 		 * Enqueue data to send with the next XHR
@@ -447,7 +478,7 @@
 				return true;
 			}
 			return false;
-		}
+		};
 
 		/**
 		 * Check if data with a particular handle is queued
@@ -457,8 +488,8 @@
 		 */
 		this.isQueued = function( handle ) {
 			return queue[handle];
-		}
-	}
+		};
+	};
 
 	$.extend( Heartbeat.prototype, {
 		tick: function( data, textStatus, jqXHR ) {
