How to use the raven-js.wrap function in raven-js

To help you get started, we’ve selected a few raven-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bfirsh / jsnes-web / src / Emulator.js View on Github external
}
    });

    this.nes = new NES({
      onFrame: this.screen.setBuffer,
      onStatusUpdate: console.log,
      onAudioSample: this.speakers.writeSample,
      sampleRate: this.speakers.getSampleRate()
    });

    // For debugging. (["nes"] instead of .nes to avoid VS Code type errors.)
    window["nes"] = this.nes;

    this.frameTimer = new FrameTimer({
      onGenerateFrame: Raven.wrap(this.nes.frame),
      onWriteFrame: Raven.wrap(this.screen.writeBuffer)
    });

    // Set up gamepad and keyboard
    this.gamepadController = new GamepadController({
      onButtonDown: this.nes.buttonDown,
      onButtonUp: this.nes.buttonUp
    });

    this.gamepadController.loadGamepadConfig();
    this.gamepadPolling = this.gamepadController.startPolling();

    this.keyboardController = new KeyboardController({
      onButtonDown: this.gamepadController.disableIfGamepadEnabled(
        this.nes.buttonDown
      ),
      onButtonUp: this.gamepadController.disableIfGamepadEnabled(
github bfirsh / jsnes-web / src / Emulator.js View on Github external
}
      }
    });

    this.nes = new NES({
      onFrame: this.screen.setBuffer,
      onStatusUpdate: console.log,
      onAudioSample: this.speakers.writeSample,
      sampleRate: this.speakers.getSampleRate()
    });

    // For debugging. (["nes"] instead of .nes to avoid VS Code type errors.)
    window["nes"] = this.nes;

    this.frameTimer = new FrameTimer({
      onGenerateFrame: Raven.wrap(this.nes.frame),
      onWriteFrame: Raven.wrap(this.screen.writeBuffer)
    });

    // Set up gamepad and keyboard
    this.gamepadController = new GamepadController({
      onButtonDown: this.nes.buttonDown,
      onButtonUp: this.nes.buttonUp
    });

    this.gamepadController.loadGamepadConfig();
    this.gamepadPolling = this.gamepadController.startPolling();

    this.keyboardController = new KeyboardController({
      onButtonDown: this.gamepadController.disableIfGamepadEnabled(
        this.nes.buttonDown
      ),
github DefinitelyTyped / DefinitelyTyped / raven-js / raven-js-tests.ts View on Github external
var throwsError = () => {
    throw new Error('broken');
};

try {
    throwsError();
} catch(e) {
    RavenJS.captureException(e);
    RavenJS.captureException(e, {tags: { key: "value" }});
}

RavenJS.context(throwsError);
RavenJS.context({tags: { key: "value" }}, throwsError);
RavenJS.context({extra: {planet: {name: 'Earth'}}}, throwsError);

setTimeout(RavenJS.wrap(throwsError), 1000);
RavenJS.wrap({logger: "my.module"}, throwsError)();
RavenJS.wrap({tags: {git_commit: 'c0deb10c4'}}, throwsError)();

RavenJS.setUserContext({
    email: 'matt@example.com',
    id: '123'
});

RavenJS.captureMessage('Broken!');
RavenJS.captureMessage('Broken!', {tags: { key: "value" }});

RavenJS.showReportDialog({
    eventId: 0815,
    dsn:'1337asdf',
    user: {
        name: 'DefenitelyTyped',
github DefinitelyTyped / DefinitelyTyped / raven-js / raven-js-tests.ts View on Github external
throw new Error('broken');
};

try {
    throwsError();
} catch(e) {
    RavenJS.captureException(e);
    RavenJS.captureException(e, {tags: { key: "value" }});
}

RavenJS.context(throwsError);
RavenJS.context({tags: { key: "value" }}, throwsError);
RavenJS.context({extra: {planet: {name: 'Earth'}}}, throwsError);

setTimeout(RavenJS.wrap(throwsError), 1000);
RavenJS.wrap({logger: "my.module"}, throwsError)();
RavenJS.wrap({tags: {git_commit: 'c0deb10c4'}}, throwsError)();

RavenJS.setUserContext({
    email: 'matt@example.com',
    id: '123'
});

RavenJS.captureMessage('Broken!');
RavenJS.captureMessage('Broken!', {tags: { key: "value" }});

RavenJS.showReportDialog({
    eventId: 0815,
    dsn:'1337asdf',
    user: {
        name: 'DefenitelyTyped',
        email: 'df@ts.ms'
github getsentry / sentry-react-native / lib / RavenClient.js View on Github external
wrap(options, func, _before) {
    return Raven.wrap(options, func, _before);
  }
}