Drivingralle,
You are on the right trail here with your code.
I’ve done some work in the JavaScript console, and my conclusion from debugging heartbeat.min.js
temporarily (source came from heartbeat.js
) is that settings.suspend is properly triggered on the ‘unload.wp-heartbeat’ event. However, I believe it to be a bug that the focused()
function sets settings.suspend back to false whenever the page is focused.
You could submit a bug indicating that the settings.suspend variable is inadvertently reverted in the focused()
function after the unload.wp-heartbeat
event is triggered and/or you could modify the heartbeat.(min).js
code accordingly, perhaps including a new custom variable settings.permanentlySuspend that is then checked along with settings.suspend in the function scheduleNextTick()
.
Hope that helps,
Ryan