@haluo/util 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/package.json +1 -1
  2. package/src/modules/monitor/.cache/00/33c4762af1e693b15e3fa078d74a0c.json +1 -1
  3. package/src/modules/monitor/.cache/05/4a95cc6ce509574551163397e6e349.json +1 -1
  4. package/src/modules/monitor/.cache/08/605045b6ae5c61b27bdafb25804d2f.json +1 -1
  5. package/src/modules/monitor/.cache/0c/dac2b7827892f4a24d1a77ac25432b.json +1 -1
  6. package/src/modules/monitor/.cache/0d/a7a0d6ef14604e1c38f209f9136c30.json +1 -1
  7. package/src/modules/monitor/.cache/13/dd597f42863f28fa335f1f5de4bd28.json +1 -1
  8. package/src/modules/monitor/.cache/20/f6fb741d627f7380914fec21c52ae0.json +1 -1
  9. package/src/modules/monitor/.cache/2b/43c7d967bc42e53b253e533c27a446.json +1 -1
  10. package/src/modules/monitor/.cache/31/f6b67a62a949d0d23542a0faf3a7ae.json +1 -1
  11. package/src/modules/monitor/.cache/36/37a4a35458c91650e820353fe14075.json +1 -1
  12. package/src/modules/monitor/.cache/44/ac0ec962164e52d524289bc6ddd746.json +1 -1
  13. package/src/modules/monitor/.cache/9b/c674aad8cee84e65a79172fb6ec4b6.json +1 -1
  14. package/src/modules/monitor/.cache/a0/8fa1dac8016c963a5865b0c2611e95.json +1 -1
  15. package/src/modules/monitor/.cache/a4/9a86eef551556949bfc33f94f813ce.json +1 -1
  16. package/src/modules/monitor/.cache/a5/ba2231eb63e08a146e516420de499c.json +1 -1
  17. package/src/modules/monitor/.cache/a6/a8ccd67182599a1ccb79a6165ecc8c.json +1 -1
  18. package/src/modules/monitor/.cache/af/77f95b5271855deb2590d95897a574.json +1 -1
  19. package/src/modules/monitor/.cache/c6/9ce3f6f2dd9e9eb0ae529457e551a9.json +1 -1
  20. package/src/modules/monitor/.cache/c7/9d09bcd88576bb759e1d8c4a4e0a60.json +1 -1
  21. package/src/modules/monitor/.cache/db/a09a856f25cd41813ee5e4e84e58f6.json +1 -1
  22. package/src/modules/monitor/.cache/f1/86d3395b74f70f5ae6289d48269ccb.json +1 -1
  23. package/src/modules/monitor/.cache/f5/4fd5972b6b66ba9484f0aa61a0d512.json +1 -1
  24. package/src/modules/monitor/dist/monitor.77de5100.js +63 -25
  25. package/src/modules/monitor/dist/monitor.77de5100.js.map +1 -1
  26. package/src/modules/monitor/index.ts +3 -5
  27. package/src/modules/monitor/lib/jsError.ts +8 -4
  28. package/src/modules/monitor/lib/xhr.ts +3 -2
  29. package/src/modules/monitor/utils/tracker.ts +2 -2
@@ -3,11 +3,9 @@ import injectXhrError from './lib/xhr'
3
3
  import Tracker from './utils/tracker'
4
4
 
5
5
  // import timing from './lib/timing'
6
- // injectJsError()
7
- // injectXhrError()
8
- export default function setup() {
9
- injectJsError()
10
- injectXhrError()
6
+ export default function setup(data:any) {
7
+ injectJsError(data)
8
+ injectXhrError(data)
11
9
  }
12
10
  export {
13
11
  Tracker
@@ -1,5 +1,5 @@
1
1
  import track from '../utils/tracker'
2
- export function injectJsError () {
2
+ export function injectJsError (data:any={}) {
3
3
  window.addEventListener('error', (e: any) => {
4
4
  if (e.target && (e.target.src || e.target.href)) {
5
5
  track.send({
@@ -7,7 +7,9 @@ export function injectJsError () {
7
7
  type: 'error',
8
8
  title: 'resourceError',
9
9
  filename: e.target.src || e.target.href,
10
- tagName: e.target.tagName
10
+ tagName: e.target.tagName,
11
+ reason: e.target.src || e.target.href,
12
+ ...data
11
13
  // selector: lastEvent ? get
12
14
  })
13
15
  return
@@ -19,7 +21,8 @@ export function injectJsError () {
19
21
  message: e.message,
20
22
  filename: e.filename,
21
23
  position: `${e.lineno}:${e.colno}`,
22
- stack: e.error.stack,
24
+ reason: e.error.stack,
25
+ ...data
23
26
  // selector: lastEvent ? get
24
27
  })
25
28
  }, true)
@@ -47,7 +50,8 @@ export function injectJsError () {
47
50
  message,
48
51
  filename,
49
52
  position: `${line}:${column}`,
50
- stack
53
+ reason: stack,
54
+ ...data
51
55
  // selector: lastEvent ? get
52
56
  })
53
57
  })
@@ -1,6 +1,6 @@
1
1
  import tracker from "../utils/tracker"
2
2
 
3
- export default function injectXHR(){
3
+ export default function injectXHR(data:any={}){
4
4
  let XMLHttpRequest:any = window.XMLHttpRequest
5
5
  let oldOpen = XMLHttpRequest.prototype.open as any
6
6
  XMLHttpRequest.prototype.open = function(method: string, url:string, async:boolean) {
@@ -24,7 +24,8 @@ export default function injectXHR(){
24
24
  duration,
25
25
  response: this.response ? JSON.stringify(this.response) : '',
26
26
  params: body || '',
27
- stack: status + '-'+statusText+` ${this.logData.url} ${this.response ? JSON.stringify(this.response) : ''}`
27
+ reason: status + '-'+statusText+` ${this.logData.url} ${this.response ? JSON.stringify(this.response) : ''}`,
28
+ ...data
28
29
  })
29
30
  }
30
31
  this.addEventListener('load', handler('load'), false)
@@ -8,8 +8,8 @@ class SendTracker {
8
8
  this.xhr = new XMLHttpRequest()
9
9
  }
10
10
  send(data:any = {}) {
11
- const log = { ...getExtraData(), reason: data.stack, ...data}
12
- fetch('https://crash.corp.mddmoto.com/app/collect/oss/app/collect/oss/original/info/report', {
11
+ const log = { ...getExtraData(), ...data}
12
+ fetch('http://172.28.140.60:9057/app/collect/oss/original/info/report', {
13
13
  method: 'POST',
14
14
  headers: {
15
15
  'Content-type': 'application/json'