-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
59 lines (49 loc) · 1.56 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Pepper Sample</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.10/c3.min.css"/>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<section class="main">
<h1>Hello Pepper x IoT</h1>
<div class="contents">
<div class="buttons">
<button class="btn plus-btn" v-on="click: plus">+1</button>
<button class="btn minus-btn" v-on="click: minus">-1</button>
</div>
<div class="display-block">
<div class="display-value" v-text="value"></div>
<div class="display-timestamp" v-text="timestamp | timestamp"></div>
</div>
</div>
<div id="chart"></div>
</section>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.10/c3.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/vue/0.11.5/vue.min.js"></script>
<script src="https://cdn.pubnub.com/pubnub-dev.js"></script>
<script src="main.js"></script>
<script>
(function(){
var threshold = 20;
var callback = function(val) {
// do somthing
console.log('change value: ', val);
};
if (window.sensorModel) {
var fired = false;
sensorModel.$watch('value', function(val) {
if (Number(val) < threshold && !fired) {
callback(val);
fired = true;
}
});
}
})();
</script>
</body>
</html>