The heartbeat API is essentially a script that is included in your site’s head. It performs calls back to the server. So, to disable the heartbeat the script must not be enqueued. And you can check whether a script is enqueued with wp_script_is
. Like this:
if (wp_script_is ('heartbeat')) ...