本文整理汇总了TypeScript中raven-js.setUserContext函数的典型用法代码示例。如果您正苦于以下问题:TypeScript setUserContext函数的具体用法?TypeScript setUserContext怎么用?TypeScript setUserContext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setUserContext函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: report
export function report(userFeedback: string, feedbackCategory: string, userEmail?: string): void {
if (!Raven.isSetup()) {
throw new IllegalStateError('Error reporter not initialized.');
}
Raven.setUserContext({email: userEmail || ''});
Raven.captureMessage(userFeedback, {tags: {category: feedbackCategory}});
Raven.setUserContext(); // Reset the user context, don't cache the email
}
示例2: setUserContext
setUserContext(user: User): void {
if (this.config.isLocal) return;
if (user.isAuthenticated) {
Raven.setUserContext({
username: user.name,
email: user.email
});
}
}
示例3: connectWith
async function connectWith(cnn: Connection): Promise<void> {
if (!localStorage || !socketClient || !webStorage) {
throw new Error("Must call Services.init() before Services.login()");
}
try {
await socketClient.connect(cnn);
await localStorage.connect(`seashell${SEASHELL_DB_VERSION_NUMBER}-${cnn.username}`);
connection = cnn;
Raven.setUserContext({id: cnn.username, email: `${cnn.username}@${DOMAIN}`});
} catch (e) {
throw new Error("Failed to connect");
}
}
示例4: clearUserContext
clearUserContext(): void {
if (this.config.isLocal) return;
Raven.setUserContext();
}
示例5: report
report(userFeedback: string, feedbackCategory: string, userEmail?: string): Promise<void> {
Raven.setUserContext({email: userEmail || ''});
Raven.captureMessage(userFeedback, {tags: {category: feedbackCategory}});
Raven.setUserContext(); // Reset the user context, don't cache the email
return Promise.resolve();
}
示例6: setUserContext
setUserContext(data?: any) {
Raven.setUserContext(data);
}