https://github.com/avatsaev/ngx-raven
Raven Module for Angular
https://github.com/avatsaev/ngx-raven
angular raven ravenjs
Last synced: 6 months ago
JSON representation
Raven Module for Angular
- Host: GitHub
- URL: https://github.com/avatsaev/ngx-raven
- Owner: avatsaev
- License: mit
- Created: 2018-01-05T14:38:56.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-12T06:21:28.000Z (about 7 years ago)
- Last Synced: 2025-03-27T12:38:28.030Z (7 months ago)
- Topics: angular, raven, ravenjs
- Language: TypeScript
- Size: 173 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NgxRaven
[](https://opensource.org/licenses/MIT)
![]()
Angular wrapper for [Sentry's](https://sentry.io/) [RavenJS](https://github.com/getsentry/raven-js)
## Installation
`npm i -S ngx-raven raven-js`
## Usage
Import Raven module in your AppModule (top level module)
```typescript
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)
```typescript
import {RavenService} 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:
```typescript
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:
```typescript
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;
}}
```