Skip to content

Commit 3fa66df

Browse files
committed
feat: improved docs
1 parent e9f72b1 commit 3fa66df

File tree

2 files changed

+30
-23
lines changed

2 files changed

+30
-23
lines changed

README.md

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ To use **ngx-fastboot**, import the `fast` function and call it with your Angula
4848

4949
#### Before
5050

51+
`main.ts`
5152
```typescript
5253
import { AppComponent } from './app.component';
5354
import { bootstrapApplication } from '@angular/platform-browser';
@@ -70,6 +71,7 @@ bootstrapApplication(AppComponent, {
7071

7172
#### After
7273

74+
`main.ts`
7375
```typescript
7476
import { AppComponent } from './app.component';
7577
import { bootstrapApplication } from '@angular/platform-browser';
@@ -107,27 +109,16 @@ export default [
107109
### Sentry Integration Example
108110
This example shows how to integrate Sentry with ngx-fastboot for error monitoring and performance tracing in your Angular application.
109111

110-
sentry.config.ts
112+
`src/app/configs/sentry.config.ts`
111113
```typescript
112114
import { APP_INITIALIZER, EnvironmentProviders, ErrorHandler, Provider } from '@angular/core';
113115
import { Router } from '@angular/router';
114116
import {
115-
browserTracingIntegration,
116117
createErrorHandler,
117118
init,
118-
replayIntegration,
119119
TraceService,
120120
} from '@sentry/angular-ivy';
121121

122-
export function initSentryConfig() {
123-
init({
124-
dsn: '<your-dsn>',
125-
integrations: [browserTracingIntegration(), replayIntegration()],
126-
...etc
127-
});
128-
console.info('Sentry initialized.');
129-
}
130-
131122
export default [
132123
{
133124
provide: ErrorHandler,
@@ -149,7 +140,25 @@ export default [
149140
] satisfies Array<Provider | EnvironmentProviders>;
150141
```
151142

152-
main.ts
143+
`src/app/configs/sentry.init.ts`
144+
```typescript
145+
import {
146+
browserTracingIntegration,
147+
init,
148+
replayIntegration,
149+
} from '@sentry/angular-ivy';
150+
151+
export function initSentryConfig() {
152+
init({
153+
dsn: '<your-dsn>',
154+
integrations: [browserTracingIntegration(), replayIntegration()],
155+
...etc
156+
});
157+
console.info('Sentry initialized.');
158+
}
159+
```
160+
161+
`src/main.ts`
153162
```typescript
154163
import { AppComponent } from './app.component';
155164
import { bootstrapApplication } from '@angular/platform-browser';
@@ -160,12 +169,11 @@ fast(bootstrapApplication, AppComponent, {
160169
() => import('./app/configs/sentry.config'),
161170
],
162171
})
163-
.then(async () => {
164-
return import('./app/configs/sentry.config').then((config) => config.initSentryConfig());
165-
})
166-
.catch((err) =>
167-
console.error(err),
168-
);
172+
.then(() => import('./app/configs/sentry.init')
173+
.then((init) => init.initSentryConfig()))
174+
.catch(error => {
175+
console.error('Error bootstrapping the app', error);
176+
});
169177

170178
```
171179

src/lib/fast.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@ import { AngularProvider, FastApplicationConfig } from './types';
3131
* MyProvider,
3232
* () => import('./my-provider.module'),
3333
* ]
34-
* }).then(appRef => {
35-
* console.log('App is bootstrapped');
36-
* }).catch(error => {
34+
* }).then(() => console.log('App is bootstrapped'))
35+
* .catch(error => {
3736
* console.error('Error bootstrapping the app', error);
38-
* });
37+
* });
3938
* ```
4039
*/
4140
export const fast = async (

0 commit comments

Comments
 (0)