# All files / common constant.ts

100% Statements 82/82
100% Branches 18/18
100% Functions 9/9
100% Lines 82/82

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130

    8x
    8x
    8x
    8x
    8x
    8x
    8x
    8x
    8x
    8x
    8x

    8x
    8x
    8x
    8x
    8x
    8x
    8x

    8x
    8x
    8x
    8x
    8x
    8x

    8x
    8x
    8x
    8x
    8x
    8x
    8x

    8x

    8x
    8x
    8x
    8x
    8x
    8x
    8x
    8x
    8x
    8x
    8x

    8x

    8x
    8x
    8x
    8x
    8x
    8x
    8x
    8x

    8x
    8x

    8x
    8x
    8x
    8x
    8x
    8x

    8x
    8x
    8x
    8x
    8x
    8x
    8x
    8x
    8x
    8x
    8x

    8x

    8x
    8x
    8x

    8x
    8x
    8x
    8x

    8x
    8x

    8x
     export type voidFun = () => void
    /**
     * 上报错误类型
     */
    export enum ERRORTYPES {
      UNKNOWN = 'UNKNOWN',
      UNKNOWN_FUNCTION = 'UNKNOWN_FUNCTION',
      JAVASCRIPT_ERROR = 'JAVASCRIPT_ERROR',
      LOG_ERROR = 'LOG_ERROR',
      FETCH_ERROR = 'HTTP_ERROR',
      VUE_ERROR = 'VUE_ERROR',
      REACT_ERROR = 'REACT_ERROR',
      RESOURCE_ERROR = 'RESOURCE_ERROR',
      PROMISE_ERROR = 'PROMISE_ERROR',
      ROUTE_ERROR = 'ROUTE_ERROR'
    }

    export enum WxAppEvents {
      AppOnLaunch = 'AppOnLaunch',
      AppOnShow = 'AppOnShow',
      AppOnHide = 'AppOnHide',
      AppOnError = 'AppOnError',
      AppOnPageNotFound = 'AppOnPageNotFound',
      AppOnUnhandledRejection = 'AppOnUnhandledRejection'
    }

    export enum WxPageEvents {
      PageOnShow = 'PageOnShow',
      PageOnHide = 'PageOnHide',
      PageOnShareAppMessage = 'PageOnShareAppMessage',
      PageOnShareTimeline = 'PageOnShareTimeline',
      PageOnTabItemTap = 'PageOnTabItemTap'
    }

    export enum WxRouteEvents {
      SwitchTab = 'switchTab',
      ReLaunch = 'reLaunch',
      RedirectTo = 'redirectTo',
      NavigateTo = 'navigateTo',
      NavigateBack = 'navigateBack',
      RouteFail = 'routeFail'
    }

    export type WxEvents = WxAppEvents | WxPageEvents | WxRouteEvents

    export const CompositeEvents = {
      ...WxAppEvents,
      ...WxPageEvents,
      ...ERRORTYPES
    }

    export type CompositeEvents = typeof CompositeEvents

    /**
     * 用户行为栈事件类型
     */
    export enum BREADCRUMBTYPES {
      ROUTE = 'Route',
      CLICK = 'UI.Click',
      CONSOLE = 'Console',
      XHR = 'Xhr',
      FETCH = 'Fetch',
      UNHANDLEDREJECTION = 'Unhandledrejection',
      VUE = 'Vue',
      REACT = 'React',
      RESOURCE = 'Resource',
      CODE_ERROR = 'Code Error',

      CUSTOMER = 'Customer',
      // wx life cycle
      APP_ON_SHOW = 'App On Show',
      APP_ON_LAUNCH = 'App On Launch',
      APP_ON_HIDE = 'App On Hide',
      PAGE_ON_SHOW = 'Page On Show',
      PAGE_ON_HIDE = 'Page On Hide',
      PAGE_ON_SHARE_APP_MESSAGE = 'Page On Share App Message',
      PAGE_ON_SHARE_TIMELINE = 'Page On Share Timeline',
      PAGE_ON_TAB_ITEM_TAP = 'Page On Tab Item Tap',

      // wx BaseEvent
      TAP = 'UI.Tap',
      TOUCHMOVE = 'UI.Touchmove'
    }

    /**
     * 用户行为整合类型
     */
    export enum BREADCRUMBCATEGORYS {
      HTTP = 'http',
      USER = 'user',
      DEBUG = 'debug',
      EXCEPTION = 'exception',
      LIFECYCLE = 'lifecycle'
    }
    /**
     * 重写的事件类型
     */
    export enum EVENTTYPES {
      XHR = 'xhr',
      FETCH = 'fetch',
      CONSOLE = 'console',
      DOM = 'dom',
      HISTORY = 'history',
      ERROR = 'error',
      HASHCHANGE = 'hashchange',
      UNHANDLEDREJECTION = 'unhandledrejection',
      MITO = 'mito',
      VUE = 'Vue',
      // for miniprogram
      MINI_ROUTE = 'miniRoute'
    }

    export enum HTTPTYPE {
      XHR = 'xhr',
      FETCH = 'fetch'
    }

    export enum HTTP_CODE {
      BAD_REQUEST = 400,
      UNAUTHORIZED = 401,
      INTERNAL_EXCEPTION = 500
    }

    export const ERROR_TYPE_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/
    const globalVar = {
      isLogAddBreadcrumb: true,
      crossOriginThreshold: 1000
    }
    export { globalVar }