Skip to content

Commit 764be24

Browse files
committed
port setUser
1 parent e44b259 commit 764be24

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

packages/hub/src/exports.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
import { Breadcrumb, CaptureContext, Event, Extra, Extras, Primitive, Severity, SeverityLevel } from '@sentry/types';
1+
import {
2+
Breadcrumb,
3+
CaptureContext,
4+
Event,
5+
Extra,
6+
Extras,
7+
Primitive,
8+
Severity,
9+
SeverityLevel,
10+
User,
11+
} from '@sentry/types';
212

313
import { getCurrentHub, Hub } from './hub';
414
import { Scope } from './scope';
@@ -124,3 +134,12 @@ export function setTags(tags: { [key: string]: Primitive }): ReturnType<Hub['set
124134
export function setTag(key: string, value: Primitive): ReturnType<Hub['setTag']> {
125135
getCurrentHub().setTag(key, value);
126136
}
137+
138+
/**
139+
* Updates user context information for future events.
140+
*
141+
* @param user User context object to be set in the current context. Pass `null` to unset the user.
142+
*/
143+
export function setUser(user: User | null): ReturnType<Hub['setUser']> {
144+
getCurrentHub().setUser(user);
145+
}

packages/minimal/src/index.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@ function callOnHub<T>(method: string, ...args: any[]): T {
2929
throw new Error(`No hub defined or ${method} was not found on the hub, please open a bug report.`);
3030
}
3131

32-
/**
33-
* Updates user context information for future events.
34-
*
35-
* @param user User context object to be set in the current context. Pass `null` to unset the user.
36-
*/
37-
export function setUser(user: User | null): void {
38-
callOnHub<void>('setUser', user);
39-
}
40-
4132
/**
4233
* Creates a new scope with and executes the given operation within.
4334
* The scope is automatically removed once the operation

0 commit comments

Comments
 (0)