wp/wp-includes/js/heartbeat.js
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
   153 				 * will limit or disable some of the functionality (like post locks).
   153 				 * will limit or disable some of the functionality (like post locks).
   154 				 * Once set at initialization, minimalInterval cannot be changed/overridden.
   154 				 * Once set at initialization, minimalInterval cannot be changed/overridden.
   155 				 */
   155 				 */
   156 				if ( options.minimalInterval ) {
   156 				if ( options.minimalInterval ) {
   157 					options.minimalInterval = parseInt( options.minimalInterval, 10 );
   157 					options.minimalInterval = parseInt( options.minimalInterval, 10 );
   158 					settings.minimalInterval = options.minimalInterval > 0 && options.minimalInterval <= 600 ? options.minimalInterval * 1000 : 0;
   158 					settings.minimalInterval = options.minimalInterval > 0 && options.minimalInterval <= 600 ? options.minimalInterval : 0;
   159 				}
   159 				}
   160 
   160 
   161 				if ( settings.minimalInterval && settings.mainInterval < settings.minimalInterval ) {
   161 				if ( settings.minimalInterval && settings.mainInterval < settings.minimalInterval ) {
   162 					settings.mainInterval = settings.minimalInterval;
   162 					settings.mainInterval = settings.minimalInterval;
   163 				}
   163 				}
   174 			}
   174 			}
   175 
   175 
   176 			// Convert to milliseconds.
   176 			// Convert to milliseconds.
   177 			settings.mainInterval = settings.mainInterval * 1000;
   177 			settings.mainInterval = settings.mainInterval * 1000;
   178 			settings.originalInterval = settings.mainInterval;
   178 			settings.originalInterval = settings.mainInterval;
       
   179 			if ( settings.minimalInterval ) {
       
   180 				settings.minimalInterval = settings.minimalInterval * 1000;
       
   181 			}
   179 
   182 
   180 			/*
   183 			/*
   181 			 * Switch the interval to 120 seconds by using the Page Visibility API.
   184 			 * Switch the interval to 120 seconds by using the Page Visibility API.
   182 			 * If the browser doesn't support it (Safari < 7, Android < 4.4, IE < 10), the
   185 			 * If the browser doesn't support it (Safari < 7, Android < 4.4, IE < 10), the
   183 			 * interval will be increased to 120 seconds after 5 minutes of mouse and keyboard
   186 			 * interval will be increased to 120 seconds after 5 minutes of mouse and keyboard