-
Notifications
You must be signed in to change notification settings - Fork 0
/
breakpoints.html
104 lines (87 loc) · 2.38 KB
/
breakpoints.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!doctype html>
<html lang="en" data-theme="dark">
<head>
<meta charset="utf-8">
<title>Breakpoints</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="icon.png">
<link rel="stylesheet" href="css/pico.css">
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<main class="container">
<section id="preview">
<h1>The power of breakpoints</h1>
<article id="article">
<img src="img/breakpoints-narrow.png" style="float: right;" alt="breakpoints">
<h2>Plain breakpoints</h2>
<p>
Just stops, same as
<code><b>debugger</b>;</code>
but works in runtime
</p>
<h2>Conditional breakpoints</h2>
<p>
Breakpoint with condition, stops only when passed expression returns
<code><i>true</i></code>
</p>
<h2>Logpoints</h2>
<p>
Just logs, same as
<code><s>console</s>.<u>log()</u>;</code>
but works in runtime
</p>
<h2>Never pause here</h2>
<span>Helps to deal with unwanted breaks on:</span>
<ul>
<li>
<code><b>debugger</b>;</code>
</li>
<li>Pause on (caught) exceptions</li>
</ul>
<p><a onclick="here()">Play here</a></p>
<script>
function here() {
const time = Date.now();
if (time % 7 === 0) {
console.log('Lucky you!')
}
debugger;
try {
throw 'caught';
} catch (e) {}
throw 'uncaught'
}
</script>
<h2>Trick of the day:</h2>
<p>
execute code without actually stopping with <code>(...) && <i>false</i></code>
</p>
</article>
<div class="grid">
<a href="log-debugger.html">
<button class="secondary">Back</button>
</a>
<div><!--spacer--></div>
<a href="other-breakpoints.html">
<button id="next">Next</button>
</a>
<script>
document.getElementById('next').onclick = e => {
var allowed = false;
console.log('Allowed', allowed);
if (!allowed && !localStorage.presentationMode) {
alert('You shall not pass!')
e.preventDefault();
}
}
</script>
</div>
</section>
</main>
<footer class="container">
WebCore 2021
</footer>
<script src="js/mode-switch.js"></script>
</body>
</html>