Skip to content

Commit

Permalink
Use either Airbrake or Hoptoad object.
Browse files Browse the repository at this point in the history
The current http://airbrakeapp.com/javascripts/notifier.js (v0.1.0)
defines a Hoptoad object, which Airbrake 3.0 expects an Airbrake object.
Add Hoptoad as a fall-back. Also wrap the first javascript with a
closure so it won't pollute the global namespace.
  • Loading branch information
romanbsd authored and Harold Giménez committed Aug 28, 2011
1 parent 74dc4ce commit 8670b27
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/templates/javascript_notifier.erb
@@ -1,13 +1,15 @@
<%= javascript_tag %Q{
(function(){
var notifierJsScheme = (("https:" == document.location.protocol) ? "https://" : "http://");
document.write(unescape("%3Cscript src='" + notifierJsScheme + "#{host}/javascripts/notifier.js' type='text/javascript'%3E%3C/script%3E"));
}
%>
})();
}%>
<%= javascript_tag %Q{
window.Airbrake = Airbrake || Hoptoad;
Airbrake.setKey('#{api_key}');
Airbrake.setHost('#{host}');
Airbrake.setEnvironment('#{environment}');
Airbrake.setErrorDefaults({ url: "#{escape_javascript url}", component: "#{controller_name}", action: "#{action_name}" });
}
}
%>

0 comments on commit 8670b27

Please sign in to comment.