|
1 |
| -import ConfigCommon from '../../config.json'; |
2 |
| - |
3 |
| -declare global { |
4 |
| - interface Window { |
5 |
| - fetchM: Function; |
6 |
| - unhandledrejectionError: Function; |
7 |
| - normalError: Function; |
8 |
| - DynamicResource: Function; |
9 |
| - resourceError: Function; |
10 |
| - } |
11 |
| -} |
12 |
| - |
13 |
| -window.fetchM = function fetchM() { |
14 |
| - const xhr = new XMLHttpRequest(); |
15 |
| - xhr.open('get', `http://localhost:${ConfigCommon.mainPort}/mainApp`, true); |
16 |
| - xhr.onreadystatechange = function () { |
17 |
| - if (xhr.readyState !== 4) { |
18 |
| - return; |
19 |
| - } |
20 |
| - if (xhr.status >= 200 && xhr.status < 300) { |
21 |
| - // console.log('mainApp xhr'); |
22 |
| - } |
23 |
| - }; |
24 |
| - xhr.send(null); |
25 |
| - |
26 |
| - fetch( |
27 |
| - `http://localhost:${ConfigCommon.mainPort}/fetch/mainApp`, |
28 |
| - ).then((res) => {}); |
29 |
| -}; |
30 |
| - |
31 |
| -window.unhandledrejectionError = function unhandledrejectionError() { |
32 |
| - setTimeout(() => { |
33 |
| - throw Error('mainApp: unhandledrejection error'); |
34 |
| - }, 500); |
35 |
| -}; |
36 |
| - |
37 |
| -window.normalError = function normalError() { |
38 |
| - throw Error('mainApp: normal error'); |
39 |
| -}; |
40 |
| - |
41 |
| -window.DynamicResource = function DynamicResource() { |
42 |
| - const sc = document.createElement('script'); |
43 |
| - sc.src = `http://localhost:${ConfigCommon.mainPort}/monitoring/dynamicScript.js`; |
44 |
| - document.body.appendChild(sc); |
45 |
| - |
46 |
| - const link = document.createElement('link'); |
47 |
| - link.href = `http://localhost:${ConfigCommon.mainPort}/monitoring/dynamicLink.css`; |
48 |
| - document.body.appendChild(link); |
49 |
| -}; |
50 |
| - |
51 |
| -window.resourceError = function resourceError() { |
52 |
| - // resource error |
53 |
| - const sc = document.createElement('script'); |
54 |
| - sc.src = `http://localhost:1111/monitoring/xxxxx.js`; |
55 |
| - document.body.appendChild(sc); |
56 |
| -}; |
| 1 | +// import ConfigCommon from '../../config.json'; |
| 2 | + |
| 3 | +// declare global { |
| 4 | +// interface Window { |
| 5 | +// fetchM: Function; |
| 6 | +// unhandledrejectionError: Function; |
| 7 | +// normalError: Function; |
| 8 | +// DynamicResource: Function; |
| 9 | +// resourceError: Function; |
| 10 | +// } |
| 11 | +// } |
| 12 | + |
| 13 | +// window.fetchM = function fetchM() { |
| 14 | +// const xhr = new XMLHttpRequest(); |
| 15 | +// xhr.open('get', `http://localhost:${ConfigCommon.mainPort}/mainApp`, true); |
| 16 | +// xhr.onreadystatechange = function () { |
| 17 | +// if (xhr.readyState !== 4) { |
| 18 | +// return; |
| 19 | +// } |
| 20 | +// if (xhr.status >= 200 && xhr.status < 300) { |
| 21 | +// // console.log('mainApp xhr'); |
| 22 | +// } |
| 23 | +// }; |
| 24 | +// xhr.send(null); |
| 25 | + |
| 26 | +// fetch( |
| 27 | +// `http://localhost:${ConfigCommon.mainPort}/fetch/mainApp`, |
| 28 | +// ).then((res) => {}); |
| 29 | +// }; |
| 30 | + |
| 31 | +// window.unhandledrejectionError = function unhandledrejectionError() { |
| 32 | +// setTimeout(() => { |
| 33 | +// throw Error('mainApp: unhandledrejection error'); |
| 34 | +// }, 500); |
| 35 | +// }; |
| 36 | + |
| 37 | +// window.normalError = function normalError() { |
| 38 | +// throw Error('mainApp: normal error'); |
| 39 | +// }; |
| 40 | + |
| 41 | +// window.DynamicResource = function DynamicResource() { |
| 42 | +// const sc = document.createElement('script'); |
| 43 | +// sc.src = `http://localhost:${ConfigCommon.mainPort}/monitoring/dynamicScript.js`; |
| 44 | +// document.body.appendChild(sc); |
| 45 | + |
| 46 | +// const link = document.createElement('link'); |
| 47 | +// link.href = `http://localhost:${ConfigCommon.mainPort}/monitoring/dynamicLink.css`; |
| 48 | +// document.body.appendChild(link); |
| 49 | +// }; |
| 50 | + |
| 51 | +// window.resourceError = function resourceError() { |
| 52 | +// // resource error |
| 53 | +// const sc = document.createElement('script'); |
| 54 | +// sc.src = `http://localhost:1111/monitoring/xxxxx.js`; |
| 55 | +// document.body.appendChild(sc); |
| 56 | +// }; |
0 commit comments