Skip to content

Commit 23f263a

Browse files
authored
Merge pull request #28 from sentry-demos/fix-bug-erroring-on-build
Reorganize function definition location to prevent error on build
2 parents 7ca52e4 + 16fa72d commit 23f263a

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

src/app/app.component.ts

+18-19
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,56 @@
1-
import { Component } from '@angular/core';
1+
import { Component } from "@angular/core";
22
import * as Sentry from "@sentry/browser";
33

4-
@Component({
5-
selector: 'app-root',
6-
templateUrl: './app.component.html',
7-
styleUrls: ['./app.component.css']
8-
})
9-
104
function block(time) {
115
const start = performance.now();
126
while (performance.now() - start < time) {}
137
}
148

9+
@Component({
10+
selector: "app-root",
11+
templateUrl: "./app.component.html",
12+
styleUrls: ["./app.component.css"],
13+
})
1514
export class AppComponent {
16-
color = 'black';
17-
textValue = '';
18-
currentUser = '';
15+
color = "black";
16+
textValue = "";
17+
currentUser = "";
1918

2019
changeColor() {
2120
var that = this;
22-
this.color = 'red';
21+
this.color = "red";
2322
setTimeout(() => {
24-
that.color = 'black'
23+
that.color = "black";
2524
}, 1500);
2625
}
2726

2827
handleSubmit() {
2928
this.currentUser = this.textValue;
30-
Sentry.configureScope(scope => {
31-
scope.setUser({email: this.currentUser});
29+
Sentry.configureScope((scope) => {
30+
scope.setUser({ email: this.currentUser });
3231
});
3332
}
3433

3534
malformed() {
36-
decodeURIComponent('%');
35+
decodeURIComponent("%");
3736
}
3837

3938
// ERRORS
4039
notAFunctionError() {
41-
var someArray = [{ func: function () {}}];
40+
var someArray = [{ func: function () {} }];
4241
someArray[1].func();
4342
}
4443

4544
uriError() {
46-
decodeURIComponent('%');
45+
decodeURIComponent("%");
4746
}
4847

4948
syntaxError() {
50-
eval('foo bar');
49+
eval("foo bar");
5150
}
5251

5352
rangeError() {
54-
throw new RangeError('Parameter must be between 1 and 100');
53+
throw new RangeError("Parameter must be between 1 and 100");
5554
}
5655

5756
profilingIssue() {

0 commit comments

Comments
 (0)