🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@sentry/browser

Package Overview
Dependencies
Maintainers
9
Versions
670
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/browser

Offical Sentry SDK for browsers

Source
npmnpm
Version
0.4.0-beta.1
Version published
Weekly downloads
7.9M
-11.37%
Maintainers
9
Weekly downloads
 
Created
Source


Sentry Browser SDK Package

npm version npm dm npm dt

General

This package is meant to be used with the Core SDK package.

Usage

First you have to create the core and use a corresponding SDK.

import * as Sentry from '@sentry/core';
import { SentryBrowser } from '@sentry/Sentrybrowser';

Sentry.create('__DSN__')
  .use(SentryBrowser)
  .install();

After that you can call function on the global sharedClient:

Sentry.getSharedClient().setTagsContext({ cordova: true });
Sentry.getSharedClient().captureMessage('test message');
Sentry.getSharedClient().captureBreadcrumb({ message: 'HOHOHOHO' });
Sentry.getSharedClient().captureException(new Error('error'));

If you don't want to use a global static instance of Sentry, you can create one on your own:

const client = await new Sentry.Client(dsn).use(MockAdapter).install()
client.setTagsContext({ cordova: true });
client.captureMessage('test message');
client.captureBreadcrumb({ message: 'HOHOHOHO' });

// OR

new Sentry.Client('__DSN__')
  .use(MockAdapter)
  .install()
  .then(client => {
    client.setTagsContext({ cordova: true });
    client.captureMessage('test message');
    client.captureBreadcrumb({ message: 'HOHOHOHO' });
  });

Notice, install() is a Promise but we internally wait until it is resolved, so it is save to call other function without waiting for it.

FAQs

Package last updated on 23 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts