1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
Installation
============
Raven is distributed in a few different methods, and should get included
after any other libraries are included, but before your own scripts.
So for example:
.. sourcecode:: html
<script src="jquery.js"></script>
<script src="https://cdn.ravenjs.com/###RAVEN_VERSION###/raven.min.js" crossorigin="anonymous"></script>
<script>Raven.config('___PUBLIC_DSN___').install();</script>
<script src="app.js"></script>
This allows the ability for Raven's integrations to instrument themselves. If
included before something like Angular, it'd be impossible to use for
example, the Angular plugin.
Using our CDN
~~~~~~~~~~~~~
We serve our own builds off of `Fastly <http://www.fastly.com/>`_. They
are accessible over both http and https, so we recommend leaving the
protocol off.
Our CDN distributes builds with and without :doc:`integrations <integrations/index>`.
.. sourcecode:: html
<script src="https://cdn.ravenjs.com/###RAVEN_VERSION###/raven.min.js" crossorigin="anonymous"></script>
This version does not include any plugins. See `ravenjs.com
<http://ravenjs.com/>`_ for more information about plugins and getting
other builds.
Bower
~~~~~
We also provide a way to deploy Raven via `bower
<http://bower.io/>`_. Useful if you want serve your own scripts instead of
depending on our CDN and mantain a ``bower.json`` with a list of
dependencies and versions (adding the ``--save`` flag would automatically
add it to ``bower.json``).
.. code-block:: sh
$ bower install raven-js --save
.. code-block:: html
<script src="/bower_components/raven-js/dist/raven.js"></script>
Also note that the file is uncompresed but is ready to pass to any decent
JavaScript compressor like `UglifyJS
<https://github.com/mishoo/UglifyJS2>`_.
npm
~~~
Raven is also available as an npm package, `raven-js
<https://www.npmjs.com/package/raven-js>`_.
.. code-block:: sh
$ npm install raven-js --save
.. code-block:: html
<script src="/node_modules/raven-js/dist/raven.js"></script>
Note that if you intend to use Raven with Node, `raven-node <https://github.com/getsentry/raven-node>`_ is the client to use.
CommonJS
~~~~~~~~
To use Raven with CommonJS imports:
.. code-block:: javascript
var Raven = require('raven-js') ;
Raven
.config('___PUBLIC_DSN___')
.install();
ES2015 (ES6)
~~~~~~~~~~~~
To use Raven with ES2015 (ES6) imports:
.. code-block:: javascript
import Raven from 'raven-js';
Raven
.config('___PUBLIC_DSN___')
.install();
Requirements
~~~~~~~~~~~~
Raven supports IE8+ and all other modern browsers, and works in Web Workers.
Raven requires the browser JavaScript environment to provide:
- Either `XHR Level 2 <http://caniuse.com/#feat=xhr2>`_ (IE10+, all other modern browsers)
or `XDomainRequest <https://developer.mozilla.org/en-US/docs/Web/API/XDomainRequest>`_ (IE8, IE9)
- A global ``JSON`` object with ``JSON.stringify`` (IE8+ `standards mode
<http://msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx>`_, all other modern browsers)
Raven does not support IE 7 or other older browsers which do not provide the required features listed above.
On those older browsers, Raven.js is designed to fail gracefully; including it on your page
will have no effect, but it won't collect and report uncaught exceptions.
|