本文整理匯總了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);
}