-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathevent.html
41 lines (35 loc) · 1.22 KB
/
event.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
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.4.js" type="application/javascript"></script>
<script src="http://looprecur.com/hostedjs/pointfree.browser.js"></script>
<script src="http://looprecur.com/hostedjs/io.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bacon.js/0.7.60/Bacon.js"
type="application/javascript"></script>
</head>
<body>
<label for="searchInput">Search</label>
<input type="text" id="searchInput"/>
<button id="searchButton">Search</button>
<script>
function setup() {
var box = document.getElementById('searchButton');
box.onclick = function () {
console.log('clicked');
};
var P = PointFree;
var IO = P.IO.IO;
var runIO = P.IO.runIO;
P.IO.extendFn();
var buttonStream = $("#searchButton").asEventStream("click");
var getText = function(x){ return document.querySelector(x).value }.toIO();
var upper = function (x) { return x.toUpperCase() };
var ex = P.compose(buttonStream);
buttonStream.subscribe(function (e) {
$("#searchInput").val("text")
});
runIO(ex);
}
$(document).ready(setup);
</script>
</body>
</html>