Skip to content

Instantly share code, notes, and snippets.

@latentflip
Created March 14, 2011 11:41
Show Gist options
  • Save latentflip/869029 to your computer and use it in GitHub Desktop.
Save latentflip/869029 to your computer and use it in GitHub Desktop.
There may be a better way to do this, but: When writing JS I often make a silly little typo or something that I don't notice unless I: - notice that something seems broken - open Chrome's developer toolbar, which I inevitably closed last time to get
-if RAILS_ENV == 'development'
:javascript
$(function() {
var notify = function(icon, title, body) {
if (window.webkitNotifications.checkPermission() == 0) {
var popup = window.webkitNotifications.createNotification(
icon, title, body);
popup.show();
return true;
}
}
//Bind the popup to window.onerror
window.onerror = function(str, url, line) {
notify("", "JS Error", str+'\n'+url+':'+line);
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment