Skip to content

Commit

Permalink
调试动态js脚本
Browse files Browse the repository at this point in the history
通过  sourceURL 与 debugger 进行调试动态的JS 文件
  • Loading branch information
Rkatsiteli committed Oct 25, 2017
1 parent 3014db7 commit 1f7f3a0
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
15 changes: 15 additions & 0 deletions 动态调试JS脚本的方法/a.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>A页面</title>
</head>
<body>
A页面,载入B页面的内容<br />
<div id="app"></div>
</body>
<script src="//unpkg.com/jquery@2.1.4/dist/jquery.min.js"></script>
<script>
$("#app").load("b.html");
</script>
</html>
1 change: 1 addition & 0 deletions 动态调试JS脚本的方法/a.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("AAAAAAAAAAAAAA")
12 changes: 12 additions & 0 deletions 动态调试JS脚本的方法/b.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>B页面</title>
</head>
<body>
<hr />
这里是B页面
</body>
<script src="b.js"></script>
</html>
17 changes: 17 additions & 0 deletions 动态调试JS脚本的方法/b.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* 方式1: //@ sourceURL=b.js(源映射)
* PS:@与sourceURL 之间保留空格
*
* 方式2:debugger
* 在要调试的地方加上 debugger
*
*
*/


//@ sourceURL=b.js

debugger
console.log(123);
debugger
console.log(456);

0 comments on commit 1f7f3a0

Please sign in to comment.