I have found a... strange, to say the least, error on Stack Overflow. I was just browsing normally and I decided to open the error console, and I saw this:
Uncaught TypeError: Cannot call method 'isHeartBeating' of undefined
I thought that was a bit odd, so I found the line on which the error was:
StackExchange.cardiologist.isHeartBeating()
Stack Exchange has a cardiologist? And it can't tell if my heart is beating?! Are we in a Q&A site or an inexperienced hospital?
Here is some context for that code:
case "answer-add":0==$("#answer-"+d.answerid).length&&(p.push(d.answerid),StackExchange.cardiologist.isHeartBeating()?StackExchange.helpers.DelayedReaction(k,5E3).trigger():k(),StackExchange.cardiologist.notifiedOfNewAnswer());break;
And here it is more readable:
case "answer-add":
0 == $("#answer-"+d.answerid).length &&
(p.push(d.answerid),
StackExchange.cardiologist.isHeartBeating() ?
StackExchange.helpers.DelayedReaction(k,5E3).trigger() :
k(),StackExchange.cardiologist.notifiedOfNewAnswer());
break;
And here it is from the dev code:
function postAnswerAdd(post) {
if ($('#answer-' + post.answerid).length != 0) return;
answersToShow.push(post.answerid);
if (StackExchange.cardiologist.isHeartBeating()) {
var newAnswers = StackExchange.helpers.DelayedReaction(showNewAnswerNotification, 5000);
newAnswers.trigger();
} else {
showNewAnswerNotification();
}
StackExchange.cardiologist.notifiedOfNewAnswer();
}
What is this strange error?
(note: it is on line 18 of https://cdn.sstatic.net/js/full.js?v=2cb347042411)
// I would have called it "heartbeatManager", but the boss doesn't like that: http://www.codinghorror.com/blog/2006/03/i-shall-call-it-somethingmanager.html
// There can be several hearts in a page
. I approve of this Time Lord technology:(