PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.5.0
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.5.0
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / js / heartbeat-3-5-0.min.js

heartbeat-3-5-0.min.js in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 3.5.0, at js/heartbeat-3-5-0.min.js

1 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var WP_Optimize_Heartbeat_Agents={},WP_Optimize_Heartbeat=function(){function e(){!1===d&&(d=!0,u(document).on("heartbeat-send",function(e,t){for(var a in WP_Optimize_Heartbeat_Agents){var n=WP_Optimize_Heartbeat_Agents[a];n.sent||("command_data"in n?(t[a]={},t[a][n.command]=n.command_data):t[a]=n.command,n.sent_time=(new Date).getTime(),n.sent=!0);var i=((new Date).getTime()-n.sent_time)/1e3;i>s&&(n.sent=!1)}}),u(document).on("heartbeat-tick",function(e,t){if("object"==typeof t.callbacks)for(var n in t.callbacks)if(a(n)){var i;try{i=JSON.parse(t.callbacks[n])}catch(r){i=t.callbacks[n]}"undefined"!=typeof i.result&&!1===i.result?wp_optimize.notices.show_notice(i.error_code,i.error_message):"undefined"!=typeof WP_Optimize_Heartbeat_Agents[n]&&WP_Optimize_Heartbeat_Agents[n].callback instanceof Function&&WP_Optimize_Heartbeat_Agents[n].callback(i),"undefined"!=typeof WP_Optimize_Heartbeat_Agents[n]&&delete WP_Optimize_Heartbeat_Agents[n]}}),n()?c=WP_Optimize_Heartbeat_Fallback():wp.heartbeat.disableSuspend())}function t(e){for(;agent_id=e.shift();)_(agent_id)}function a(e){return 0===e.indexOf("wpo-heartbeat-")}function n(){return"undefined"==typeof wp.heartbeat}function i(e,t){var a=e.command===t.command,n=!1===e.sent;return a&&n}function r(e){var t=Object.values(WP_Optimize_Heartbeat_Agents).some(function(t){return i(t,e)});if(t&&("undefined"==typeof e._unique||1==e._unique))return null;var a="wpo-heartbeat-"+f();return e.sent=!1,WP_Optimize_Heartbeat_Agents[a]=e,"undefined"!=typeof e._wait&&!1===e._wait&&o(),a}function o(){n()?c.do_heartbeat():setTimeout(function(){wp.heartbeat.connectNow()},50)}function _(e){var t=WP_Optimize_Heartbeat_Agents[e];"undefined"!=typeof t&&"undefined"!=typeof t._keep&&0==t._keep&&delete WP_Optimize_Heartbeat_Agents[e]}var c,u=jQuery,s=60,d=!1,f=function(){var e=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()};return{setup:e,add_agent:r,cancel_agents:t,cancel_agent:_}},WP_Optimize_Heartbeat_Fallback=function(){function e(n){n="undefined"==typeof n?a.interval:n;var i=Object.assign({},a),r={};jQuery(document).trigger("heartbeat-send",r),i.data=r,jQuery.ajax({type:"post",dataType:"json",url:wpo_heartbeat_ajax.ajaxurl,data:i,success:function(e){"undefined"!=typeof e.callbacks&&jQuery(document).trigger("heartbeat-tick",e)}}),t&&clearTimeout(t),t=setTimeout(e,1e3*n,n)}var t,a={data:{},interval:wpo_heartbeat_ajax.interval,_nonce:wpo_heartbeat_ajax.nonce,action:"heartbeat",screen_id:window.pagenow,has_focus:!1};return t=setTimeout(e,1e3*a.interval,a.interval),{do_heartbeat:e}};