Skip to content

Commit d2ec242

Browse files
committed
[v7] Add setScope method on the client
1 parent df38d9a commit d2ec242

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/core/src/baseclient.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export abstract class BaseClient<O extends Options> implements ClientLike<O> {
7979

8080
protected _lastEventId?: string;
8181

82-
protected _scope = new Scope();
82+
protected _scope: ScopeLike = new Scope();
8383

8484
protected _eventProcessors: EventProcessor[] = [];
8585

@@ -107,6 +107,10 @@ export abstract class BaseClient<O extends Options> implements ClientLike<O> {
107107
return this._scope;
108108
}
109109

110+
public setScope(scope: ScopeLike): void {
111+
this._scope = scope;
112+
}
113+
110114
// TODO: Run these during event processing
111115
public addEventProcessor(callback: EventProcessor): void {
112116
this._eventProcessors.push(callback);

packages/types/src/client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ import { Session } from './session';
1717
export interface ClientLike<O extends Options = Options> {
1818
options: O;
1919

20-
lastEventId(): string | undefined;
2120
getScope(): ScopeLike;
21+
setScope(scope: ScopeLike): void;
2222
addEventProcessor(callback: EventProcessor): void;
2323
// TODO: To be removed? Can be obtained from options
2424
getDsn(): Dsn | undefined;
25+
lastEventId(): string | undefined;
2526

2627
captureException(exception: unknown, captureContext?: CaptureContext): string | undefined;
2728
captureMessage(message: string, captureContext?: CaptureContext): string | undefined;

0 commit comments

Comments
 (0)