Skip to content

Latest commit

 

History

History

requirejs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Using Rollbar with RequireJS

  1. Require and initialize the Rollbar javascript module:
//
// Download the latest rollbar.min.js and place in current directory.
var rollbarConfig = {
  accessToken: '...',
  captureUncaught: true,
  payload: {
    environment: 'development',
  },
};

// Require the Rollbar library
require(['rollbar.umd.min'], function (Rollbar) {
  var rollbar = Rollbar.init(rollbarConfig);
  rollbar.info('Hello world');
});
  1. Report exceptions and messages in your code:
try {
  foo();
  rollbar.debug('foo() called');
} catch (e) {
  rollbar.error('Problem calling foo()', e);
}

Test the example

  1. Edit test.html and add your Rollbar POST_CLIENT_ITEM_ACCESS_TOKEN
    • Sign up for a free account here
  2. Open test.html in your browser and click the button
  3. Go to your project dashboard and see the error

Screenshot