本文整理汇总了TypeScript中@sentry/browser.configureScope函数的典型用法代码示例。如果您正苦于以下问题:TypeScript configureScope函数的具体用法?TypeScript configureScope怎么用?TypeScript configureScope使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了configureScope函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: switchMap
switchMap(user => {
if (user) {
Sentry.configureScope((scope) => {
scope.setUser({ 'email': user.email });
});
return this.afs.doc<User>(`users/${user.uid}`).valueChanges();
} else {
return of(null);
}
}),
示例2: init
(() => {
// Desativa o plugin em localhost
if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
return;
}
const { REACT_APP_SENTRY_DSN, REACT_APP_VERSION, REACT_APP_NODE_ENV } = process.env;
if (!REACT_APP_SENTRY_DSN) {
return;
}
init({ dsn: REACT_APP_SENTRY_DSN, release: REACT_APP_VERSION, environment: REACT_APP_NODE_ENV });
configureScope(scope => {
});
})();
示例3: next
const ravenMiddleware: Middleware<{}, State> = (store) => {
Sentry.configureScope((scope) => {
scope.addEventProcessor((event) =>
produce(event, (draft) => {
draft.extra!['redux:state'] = stateTransformer(store.getState());
}),
);
});
return (next) => (action) => {
Sentry.addBreadcrumb({
category: 'redux-action',
message: action.type,
});
return next(action);
};
};
示例4: canUseBrowserLocalStorage
const browserCanUseLocalStorage = canUseBrowserLocalStorage();
const isBrowserSupported =
bowser.check(
{
msedge: '14',
chrome: '56',
firefox: '52',
safari: '10',
},
true,
) ||
(bowser.ios && parseFloat(bowser.osversion));
// Add unsupported tag so that we can filter out reports from those users
Sentry.configureScope((scope) => {
scope.setTag('unsupported', String(!isBrowserSupported));
});
if (!isBrowserSupported) {
// Show unsupported browser warning
if (
(browserCanUseLocalStorage && !localStorage.getItem(BROWSER_WARNING_KEY)) ||
!browserCanUseLocalStorage
) {
const promptText = (() => {
// Users can only update Safari by updating the OS in iOS
if (bowser.ios)
return `NUSMods may not work properly. Please consider updating your device to iOS 11 or higher.`;
if (bowser.android && bowser.chrome)
return `NUSMods may not work properly. Please consider ${linkForChromePlayStore}.`;
return `NUSMods may not work properly. Please consider updating your web browser or switching to the latest version of ${linkForChrome} or ${linkForFirefox}.`;