UNPKG

2.31 kBHTMLView Raw
1<!DOCTYPE html>
2<html lang="zh-cn">
3
4<head>
5 <meta charset="UTF-8">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <meta http-equiv="X-UA-Compatible" content="ie=edge">
8 <title>测试 | debugger</title>
9 <script src="./build/debug.console.min.js"></script>
10</head>
11
12<body>
13
14 <h2>
15 @yelloxing/debugger - 🎈 一个用于移动端的WEB调试工具。
16 </h2>
17 <p>
18 请点击右侧的调试按钮查看捕获结果!
19 </p>
20 <h4>Network测试</h4>
21 <ul>
22 <li onclick='doSend("get","package.json")'>[地址存在]点击发送get请求</li>
23 <li onclick='doSend("get","package2.json")'>[地址不存在]点击发送get请求</li>
24 <li onclick='doSend("post","package.json")'>点击发送post请求</li>
25 <li onclick='doSend("get","https://github.com/yelloxing/image2D")'>[网络的]点击发送get请求</li>
26 </ul>
27
28 <script>
29
30 /**
31 * network测试
32 */
33 function doSend(methodName, url) {
34 //创建xhr对象
35 var xhr;
36 // if (window.XMLHttpRequest) {
37 xhr = new XMLHttpRequest();
38 // } else {
39 // xhr = new ActiveXObject('Microsoft.XMLHTTP');
40 // }
41
42 xhr.onreadystatechange = function () {
43 // console.log("network:", xhr);
44 };
45
46 //发送请求
47 xhr.open(methodName, url, false);
48 xhr.send({
49 "key": "value"
50 });
51
52 }
53
54 /**
55 * storage测试
56 */
57
58 for (let i = 0; i < 10; i++) {
59 localStorage.setItem('key' + i, 'value:' + new Date().valueOf());
60 sessionStorage.setItem('key' + i, 'value:' + new Date().valueOf());
61 }
62
63 /**
64 * console测试
65 */
66
67 console.log({ top: "146px", left: "915px" });
68 console.log(true);
69 console.log(window);
70
71 console.log(document.getElementsByTagName('meta')[0]);
72 console.log(document.getElementsByTagName('meta'));
73
74 console.log(document.getElementsByName('dd'));
75
76 var doit = function () {
77 console.log('hello world');
78 };
79 console.log(doit);
80
81
82 console.log('log');
83 console.info('info');
84 console.debug('debug');
85 console.warn('warn');
86 console.error('error');
87 console.trace('trace');
88 // throw new Error('一个错误');
89
90 </script>
91</body>
92
93</html>
\No newline at end of file