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