-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathwa-irled.html
More file actions
61 lines (52 loc) · 1.25 KB
/
wa-irled.html
File metadata and controls
61 lines (52 loc) · 1.25 KB
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
<html>
<head>
<script type="text/javascript" src="../webduino-js/src/module/IRLed.js"></script>
</head>
<body>
<script>
(function() {
var proto = Object.create(HTMLElement.prototype, {
encode: {
get: function() {
return this.getAttribute('encode');
},
set: function(val) {
this.setAttribute('encode', val);
}
},
initsend: {
get: function() {
return this.getAttribute('initsend');
},
set: function(val) {
this.setAttribute('initsend', val);
}
}
});
proto.init_ = function(board) {
var observer, config, IRLed = webduino.module.IRLed;
this.irled = new IRLed(board, this.encode);
if (this.initsend === 'true') {
this.send();
}
};
proto.send = function(code) {
code = code || this.encode;
this.irled.send(code);
};
proto.attributeChangedCallback = function(attrName, oldVal, newVal) {
if (this.irled) {
switch (attrName) {
case 'encode':
this.irled.updateEncode(newVal);
break;
}
}
};
document.registerElement('wa-irled', {
prototype: proto
});
})();
</script>
</body>
</html>