當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript react-native-sentry.Sentry類代碼示例

本文整理匯總了TypeScript中react-native-sentry.Sentry的典型用法代碼示例。如果您正苦於以下問題:TypeScript Sentry類的具體用法?TypeScript Sentry怎麽用?TypeScript Sentry使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Sentry類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

  _logOut: function(store, gracefulExit) {

    Sentry.captureBreadcrumb({
      category: 'logout',
      data: {
        state:'startLogOut'
      }
    });
    // TODO: Wait for possibly pending sync to stop
    eventBus.emit("showLoading", {text:lang("Logging_out_and_closing_a"), opacity:0.25});

    // clear position for this device.
    let state = store.getState();
    let deviceId = Util.data.getCurrentDeviceId(state);
    Actions.logout();

    // clear all events listeners, should fix a lot of redraw issues which will crash at logout
    eventBus.clearAllEvents();
    NativeBus.clearAllEvents();

    // sign out of all spheres.
    let sphereIds = Object.keys(state.spheres);
    sphereIds.forEach((sphereId) => {
      store.dispatch({type: 'SET_SPHERE_STATE', sphereId: sphereId, data: {reachable: false, present: false}});
    });

    BluenetPromiseWrapper.clearTrackedBeacons().catch(() => {});
    Bluenet.stopScanning();
    CLOUD.forDevice(deviceId).exitSphere("*")  // will also clear location
      .catch(() => {})
      .then(() => {
        return StoreManager.userLogOut()
      })
      .then(() => {
        LOG.info("Quit app due to logout.");
        gracefulExit();
      })
      .catch((err) => {
        LOGe.info("Could not log user out!", err);
        gracefulExit();
      });
  },
開發者ID:crownstone,項目名稱:CrownstoneApp,代碼行數:42,代碼來源:AppUtil.ts

示例2:

 .then((update) => {
   if (update) {
     Sentry.setVersion(`${update.appVersion}-codepush:${update.label}`);
   }
 });
開發者ID:birkir,項目名稱:kvikmyndr-app,代碼行數:5,代碼來源:sentry.ts

示例3:

import { NativeModules } from "react-native"
const { Emission } = NativeModules

import { Sentry } from "react-native-sentry"

// AREmission sets this to "" if not configured, which is falsy in JS so this conditional is fine.
if (Emission.sentryDSN) {
  Sentry.config(Emission.sentryDSN).install()
}
開發者ID:artsy,項目名稱:emission,代碼行數:9,代碼來源:ErrorReporting.ts

示例4: function

  sync: function (store, background = true) {
    if (this.__currentlySyncing) {
      LOG.info("SYNC: Skip Syncing, sync already in progress.");
      return new Promise((resolve, reject) => { resolve(true) });
    }

    let state = store.getState();
    if (!state.user.userId) {
      // do not sync if we're not logged in
      return;
    }

    let cancelFallbackCallback = Scheduler.scheduleBackgroundCallback(() => {
      if (this.__currentlySyncing === true) {
        this.__currentlySyncing = false;
      }
    }, 30000);

    LOG.info("Sync: Start Syncing.");
    this.__currentlySyncing = true;

    // set the authentication tokens
    let userId = state.user.userId;
    let accessToken = state.user.accessToken;
    CLOUD.setAccess(accessToken);
    CLOUD.setUserId(userId);

    eventBus.emit("CloudSyncStarting");

    Sentry.captureBreadcrumb({
      category: 'sync',
      data: {
        state:'start'
      }
    });

    let globalCloudIdMap = getGlobalIdMap();
    let globalSphereMap = {};

    let actions = [];
    let userSyncer = new UserSyncer(actions, [], globalCloudIdMap);

    LOG.info("Sync: START Sync Events.");
    return syncEvents(store)
      // in case the event sync fails, check if the user accessToken is invalid, try to regain it if that's the case and try again.
      .catch(getUserIdCheckError(state, store, () => {
        LOG.info("Sync: RETRY Sync Events.");
        return this.syncEvents(store);
      }))
      .then(() => {
        LOG.info("Sync: DONE Sync Events.");
        LOG.info("Sync: START userSyncer sync.");
        return userSyncer.sync(store)
      })
      .catch(getUserIdCheckError(state, store, () => {
        LOG.info("Sync: RETRY userSyncer Sync.");
        return userSyncer.sync(store)
      }))
      .then(() => {
        LOG.info("Sync: DONE userSyncer sync.");
        LOG.info("Sync: START FirmwareBootloader sync.");
        let firmwareBootloaderSyncer = new FirmwareBootloaderSyncer(actions, [], globalCloudIdMap);
        return firmwareBootloaderSyncer.sync(store);
      })
      .then(() => {
        LOG.info("Sync: DONE FirmwareBootloader sync.");
        LOG.info("Sync: START SphereSyncer sync.");
        let sphereSyncer = new SphereSyncer(actions, [], globalCloudIdMap, globalSphereMap);
        return sphereSyncer.sync(store);
      })
      .then(() => {
        LOG.info("Sync: DONE SphereSyncer sync.");
        LOG.info("Sync: START KeySyncer sync.");
        let keySyncer = new KeySyncer(actions, [], globalCloudIdMap);
        return keySyncer.sync(store);
      })
      .then(() => {
        LOG.info("Sync: DONE KeySyncer sync.");
        LOG.info("Sync: START DeviceSyncer sync.");
        let deviceSyncer = new DeviceSyncer(actions, [], globalCloudIdMap);
        return deviceSyncer.sync(state);
      })
      .then(() => {
        LOG.info("Sync: DONE DeviceSyncer sync.");
        LOG.info("Sync: START Fingerprint sync.");
        let fingerprintSyncer = new FingerprintSyncer(actions, [], globalCloudIdMap, globalSphereMap);
        return fingerprintSyncer.sync(state);
      })
      .then(() => {
        LOG.info("Sync: DONE Fingerprint sync.");
        LOG.info("Sync: START Preferences sync.");
        let preferenceSyncer = new PreferenceSyncer(actions, [], globalCloudIdMap);
        return preferenceSyncer.sync(state);
      })
      .then(() => {
        LOG.info("Sync: DONE Preferences sync.");
        LOG.info("Sync: START syncPowerUsage.");
        return syncPowerUsage(state, actions);
      })
      .then(() => {
//.........這裏部分代碼省略.........
開發者ID:crownstone,項目名稱:CrownstoneApp,代碼行數:101,代碼來源:sync.ts


注:本文中的react-native-sentry.Sentry類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。