Skip to content

Commit 7b85826

Browse files
committed
ref: Remove scope listeners
1 parent 6a23c16 commit 7b85826

File tree

2 files changed

+0
-33
lines changed

2 files changed

+0
-33
lines changed

packages/hub/src/scope.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,6 @@ export class Scope implements ScopeInterface {
4949
return this;
5050
}
5151

52-
/**
53-
* This will be called on every set call.
54-
*/
55-
protected notifyScopeListeners(): void {
56-
if (!this.notifyingListeners) {
57-
this.notifyingListeners = true;
58-
setTimeout(() => {
59-
this.scopeListeners.forEach(callback => {
60-
callback(this);
61-
});
62-
this.notifyingListeners = false;
63-
});
64-
}
65-
}
66-
6752
/**
6853
* This will be called after {@link applyToEvent} is finished.
6954
*/
@@ -97,7 +82,6 @@ export class Scope implements ScopeInterface {
9782
*/
9883
public setUser(user: User): Scope {
9984
this.user = safeNormalize(user);
100-
this.notifyScopeListeners();
10185
return this;
10286
}
10387

@@ -106,7 +90,6 @@ export class Scope implements ScopeInterface {
10690
*/
10791
public setTag(key: string, value: string): Scope {
10892
this.tags = { ...this.tags, [key]: safeNormalize(value) };
109-
this.notifyScopeListeners();
11093
return this;
11194
}
11295

@@ -115,7 +98,6 @@ export class Scope implements ScopeInterface {
11598
*/
11699
public setExtra(key: string, extra: any): Scope {
117100
this.extra = { ...this.extra, [key]: safeNormalize(extra) };
118-
this.notifyScopeListeners();
119101
return this;
120102
}
121103

@@ -124,7 +106,6 @@ export class Scope implements ScopeInterface {
124106
*/
125107
public setFingerprint(fingerprint: string[]): Scope {
126108
this.fingerprint = safeNormalize(fingerprint);
127-
this.notifyScopeListeners();
128109
return this;
129110
}
130111

@@ -133,7 +114,6 @@ export class Scope implements ScopeInterface {
133114
*/
134115
public setLevel(level: Severity): Scope {
135116
this.level = safeNormalize(level);
136-
this.notifyScopeListeners();
137117
return this;
138118
}
139119

@@ -165,7 +145,6 @@ export class Scope implements ScopeInterface {
165145
this.user = {};
166146
this.level = undefined;
167147
this.fingerprint = undefined;
168-
this.notifyScopeListeners();
169148
}
170149

171150
/**
@@ -176,7 +155,6 @@ export class Scope implements ScopeInterface {
176155
maxBreadcrumbs !== undefined && maxBreadcrumbs >= 0
177156
? [...this.breadcrumbs, safeNormalize(breadcrumb)].slice(-maxBreadcrumbs)
178157
: [...this.breadcrumbs, safeNormalize(breadcrumb)];
179-
this.notifyScopeListeners();
180158
}
181159

182160
/**

packages/hub/test/scope.test.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,6 @@ describe('Scope', () => {
7575
expect((scope as any).extra).toEqual({ a: 2 });
7676
});
7777

78-
test('listeners', () => {
79-
jest.useFakeTimers();
80-
const scope = new Scope();
81-
const listener = jest.fn();
82-
scope.addScopeListener(listener);
83-
scope.setExtra('a', 2);
84-
jest.runAllTimers();
85-
expect(listener).toHaveBeenCalled();
86-
expect(listener.mock.calls[0][0].extra).toEqual({ a: 2 });
87-
});
88-
8978
test('applyToEvent', () => {
9079
expect.assertions(6);
9180
const scope = new Scope();

0 commit comments

Comments
 (0)