LEFT | RIGHT |
(no file at all) | |
1 /* globals module, require */ | |
2 | |
3 "use strict"; | 1 "use strict"; |
4 | 2 |
5 const IOElement = require("../js/io-element"); | 3 const IOElement = require("../js/io-element"); |
6 | 4 |
7 class IOClock extends IOElement | 5 class IOClock extends IOElement |
8 { | 6 { |
9 connectedCallback() | 7 connectedCallback() |
10 { | 8 { |
11 this._timer = setInterval(() => this.render(), 1000); | 9 this._timer = setInterval(() => this.render(), 1000); |
12 } | 10 } |
13 | 11 |
14 disconnectedCallback() | 12 disconnectedCallback() |
15 { | 13 { |
16 clearInterval(this._timer); | 14 clearInterval(this._timer); |
17 } | 15 } |
18 | 16 |
19 render() | 17 render() |
20 { | 18 { |
21 this.html` | 19 this.html` |
22 ${{i18n: "io_clock"}} | 20 ${{i18n: "io_clock"}} |
23 @${(new Date()).toLocaleTimeString()} | 21 @${(new Date()).toLocaleTimeString()} |
24 `; | 22 `; |
25 } | 23 } |
26 } | 24 } |
27 | 25 |
28 IOClock.define("io-clock"); | 26 IOClock.define("io-clock"); |
LEFT | RIGHT |