-
Notifications
You must be signed in to change notification settings - Fork 0
/
example1.html
40 lines (33 loc) · 1.05 KB
/
example1.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
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Pipeline.js ⟚ Simple Example</title>
<script src="../dist/pipeline.js"></script>
<script>
document.onreadystatechange = function() {
if (document.readyState !== 'interactive') return
var clicksListElem = document.getElementById('clicks-list');
var bodyClicks = window.bodyClicks = new PL.Inlet();
document.addEventListener('mouseup', function(event) {
bodyClicks.sendNext(event);
});
bodyClicks.onNext(function(event) {
// display the click coordinates in the list
var newClickItem = document.createElement('li');
newClickItem.textContent = 'new click at coordinates ['+event.clientX+', '+event.clientY+']';
clicksListElem.appendChild(newClickItem)
// log the event for console inspection
console.log('new click:', event)
});
}
</script>
</head>
<body>
<h1>Pipeline.js ⟚ Simple Example</h1>
<p>
<small>(open your console)</small>
</p>
<ul id="clicks-list"></ul>
</body>
</html>