diff --git a/docs/usage/index.rst b/docs/usage/index.rst index 0d13971d8b4d..c8e01f9c8017 100644 --- a/docs/usage/index.rst +++ b/docs/usage/index.rst @@ -115,6 +115,15 @@ This is often used to display for the user and report an error to customer servi Raven.captureMessage('Broken!') alert(Raven.lastEventId()) + +Check if Raven is setup and ready to go +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: javascript + + Raven.isSetup() + + Dealing with minified source code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/raven.js b/src/raven.js index e9e6a430f436..e7e33c1c01db 100644 --- a/src/raven.js +++ b/src/raven.js @@ -323,6 +323,15 @@ var Raven = { */ lastEventId: function() { return lastEventId; + }, + + /* + * Determine if Raven is setup and ready to go. + * + * @return {boolean} + */ + isSetup: function() { + return isSetup(); } }; diff --git a/test/raven.test.js b/test/raven.test.js index a92f5936cb95..71a3158d9942 100644 --- a/test/raven.test.js +++ b/test/raven.test.js @@ -1639,4 +1639,14 @@ describe('Raven (public API)', function() { assert.isFalse(TraceKit.report.called); }); }); + + describe('.isSetup', function() { + it('should work as advertised', function() { + var isSetup = this.sinon.stub(window, 'isSetup'); + isSetup.returns(true); + assert.isTrue(Raven.isSetup()); + isSetup.returns(false); + assert.isFalse(Raven.isSetup()); + }); + }); });