1.0.5 • Published 6 years ago

ngx-raven v1.0.5

Weekly downloads
8
License
MIT
Repository
github
Last release
6 years ago

NgxRaven

License: MIT

Angular wrapper for Sentry's RavenJS

Installation

npm i -S ngx-raven raven-js

Usage

Import Raven module in your AppModule (top level module)

import {RavenModule} from 'ngx-raven';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    RavenModule.forRoot({
      dsn: '__PUBLIC_DSN__',
      reportDialog: true, // optional, false by default
      enabled: environment.production
    })
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

Inject RavenService in your AppComponent (top level component)

import {RavenModule} from 'ngx-raven';

@Component({
  selector: 'app-root',
  template: ``,
  styles: [``]
})
export class AppComponent {

  constructor(private ravenService: RavenService) {}


}

Raven will initialize and install itself after the injection, all exceptions will be automatically sent to your Sentry server.

You can use the RavenService to access raven instance inside your components or other services:

export class AppComponent {

  constructor(private ravenService: RavenService) {
    // Check if raven is initialised and installed
    console.log(this.ravenService.raven.isSetup());
  }


}

You can also read/write in the Raven Module Configuration by injecting it:

export class AppComponent {

  constructor(private ravenService: RavenService, private ravenConfig: RavenConfig) {
    // Check if raven is initialised
    console.log(this.ravenService.raven.isSetup());
    console.log(this.ravenConfig.dsn);
    this.ravenConfig.reportDialog = false;
  }

}
1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.0

6 years ago

1.0.1

6 years ago