Repository URL to install this package:
|
Version:
1.2.6 ▾
|
"use strict";
// normally these would be come in the form of ES2015 import statements
const _Inferno = Inferno,
render = _Inferno.render,
Component = _Inferno.Component,
version = _Inferno.version;
const Chain = Chainable;
const chain = new Chain();
const now = () => Date.now();
const prettyDate = x => new Date(x).toLocaleTimeString();
chain.methods('time').build().transform('time', x => now()).transform('time', prettyDate);
const clock = jsx();
clock.state = {
chain
};
clock.didMount(() => clock.timer = setInterval(chain.time, 1000));
clock.willUnmount = () => clearInterval(clock.timer); // or .end('span') .span('/>') or .span(';')
clock.render(() => chain.div({
class: 'eh'
}).span({
onClick: console.log
}).text(chain.get('time')).end().end());
chain.observe('time', time => clock.update()); // render an instance of Clock into <body>:
render(clock, document.getElementById('container'));