Skip to content

Commit d77fce1

Browse files
authored
Add files via upload
1 parent 23820d8 commit d77fce1

25 files changed

+1570
-0
lines changed

Vue源码分析.svg

Lines changed: 832 additions & 0 deletions
Loading

vue.js中HOOK函数.docx

14.8 KB
Binary file not shown.
Binary file not shown.

vue数据监听.docx

40.1 KB
Binary file not shown.

vue源码分析.docx

13 KB
Binary file not shown.

vue源码分析.jpg

42.6 KB
Loading

vue源码帖子分析.docx

11.5 KB
Binary file not shown.

vue零散代码分析.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<html>
2+
<body>
3+
<script type="text/javascript">
4+
/* istanbul ignore next */
5+
function isNative (Ctor) {
6+
7+
return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
8+
}
9+
function code(){
10+
var native='native codedsfgf'
11+
}
12+
console.log(typeof code === 'function')
13+
console.log( code.toString() )
14+
console.log(isNative(code))
15+
</script>
16+
</body>
17+
</html>

window_performance.html

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Title</title>
6+
<link rel="stylesheet" type="text/css" href="//cdn.bootcss.com/bootstrap/4.0.0-alpha.6/css/bootstrap.css" />
7+
</head>
8+
<body>
9+
<script>
10+
for(var i=0; i<1000000000; i++){
11+
12+
}
13+
;
14+
(function() {
15+
16+
handleAddListener('load', getTiming)
17+
18+
function handleAddListener(type, fn) {
19+
if(window.addEventListener) {
20+
window.addEventListener(type, fn)
21+
} else {
22+
window.attachEvent('on' + type, fn)
23+
}
24+
}
25+
26+
function getTiming() {
27+
try {
28+
var time = performance.timing;
29+
var timingObj = {};
30+
31+
var loadTime = (time.loadEventEnd - time.loadEventStart) / 1000;
32+
33+
if(loadTime < 0) {
34+
setTimeout(function() {
35+
getTiming();
36+
}, 200);
37+
return;
38+
}
39+
40+
timingObj['重定向时间'] = (time.redirectEnd - time.redirectStart) / 1000;
41+
timingObj['DNS解析时间'] = (time.domainLookupEnd - time.domainLookupStart) / 1000;
42+
timingObj['TCP完成握手时间'] = (time.connectEnd - time.connectStart) / 1000;
43+
timingObj['HTTP请求响应完成时间'] = (time.responseEnd - time.requestStart) / 1000;
44+
timingObj['DOM开始加载前所花费时间'] = (time.responseEnd - time.navigationStart) / 1000;
45+
timingObj['DOM加载完成时间'] = (time.domComplete - time.domLoading) / 1000;
46+
timingObj['DOM结构解析完成时间'] = (time.domInteractive - time.domLoading) / 1000;
47+
timingObj['脚本加载时间'] = (time.domContentLoadedEventEnd - time.domContentLoadedEventStart) / 1000;
48+
timingObj['onload事件时间'] = (time.loadEventEnd - time.loadEventStart) / 1000;
49+
timingObj['页面完全加载时间'] = (timingObj['重定向时间'] + timingObj['DNS解析时间'] + timingObj['TCP完成握手时间'] + timingObj['HTTP请求响应完成时间'] + timingObj['DOM结构解析完成时间'] + timingObj['DOM加载完成时间']);
50+
51+
for(item in timingObj) {
52+
console.log(item + ":" + timingObj[item] + '毫秒(ms)');
53+
}
54+
55+
console.log(performance.timing);
56+
57+
} catch(e) {
58+
console.log(timingObj)
59+
console.log(performance.timing);
60+
}
61+
}
62+
})();
63+
</script>
64+
</body>
65+
</html>

window_performance1.html

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Title</title>
6+
<link rel="stylesheet" type="text/css" href="//cdn.bootcss.com/bootstrap/4.0.0-alpha.6/css/bootstrap.css" />
7+
</head>
8+
<body>
9+
<script>
10+
// https://segmentfault.com/a/1190000002445735
11+
12+
// window.webkitPerformance : chrome6-9
13+
// window.performance : ie9 chrome10+
14+
{
15+
16+
var perf = window.performance||window.webkitPerformance;
17+
18+
19+
/* istanbul ignore if */
20+
if (
21+
perf &&
22+
perf.mark &&
23+
perf.measure &&
24+
perf.clearMarks &&
25+
perf.clearMeasures
26+
) {
27+
mark = function (tag) { return perf.mark(tag); };
28+
measure = function (name, startTag, endTag) {
29+
perf.measure(name, startTag, endTag);
30+
perf.clearMarks(startTag);
31+
perf.clearMarks(endTag);
32+
perf.clearMeasures(name);
33+
};
34+
}
35+
}
36+
console.log(perf.mark)
37+
38+
console.log(mark('vue-perf-start1'))
39+
console.log(measure)
40+
41+
</script>
42+
</body>
43+
</html>

0 commit comments

Comments
 (0)