Skip to content

Instantly share code, notes, and snippets.

@latentflip
Created March 14, 2011 11:42
Show Gist options
  • Save latentflip/869030 to your computer and use it in GitHub Desktop.
Save latentflip/869030 to your computer and use it in GitHub Desktop.
Gives a growl like popup if a page has an error. Useful under development.
-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);
};
});
@latentflip
Copy link
Author

Good idea, I might just do that. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment