skate.define('x-counter', {
props: {
count: skate.prop.number(),
},
attached(elem) {
elem.__ival = setInterval(() => ++elem.count, 1000);
},
detached(elem) {
clearInterval(elem.__ival);
},
render(elem) {
return <span>Count: {elem.count}</span>;
},
});