Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
WordPress 3.5 Compatible Heartbeat API Usage
// enqueue the script,
// this fails gracefully if no 'heartbeat' script is registered
(function($) {
// watch for heartbeat event,
// no event will happen if the script isn't included
$(document).on('heartbeat-connection-lost', function() {
// do what you need to do here
}).on('heartbeat-connection-restored', function() {
// do what you need to do here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.