Skip to content

Instantly share code, notes, and snippets.

@bofrede
Last active September 4, 2015 00:55
Show Gist options
  • Save bofrede/238661 to your computer and use it in GitHub Desktop.
Save bofrede/238661 to your computer and use it in GitHub Desktop.
Debug function that works on all browsers.
function debug(aMsg) {
if (window.console) {
window.console.log(aMsg);
} else if (window.dump) {
window.dump(aMsg + '\n');
} else {
setTimeout(function () {
throw new Error('[debug] ' + aMsg);
}, 0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment