зеркало из
https://github.com/iharh/notes.git
synced 2025-11-02 06:36:06 +02:00
25 строки
709 B
Plaintext
25 строки
709 B
Plaintext
https://codepen.io/
|
|
|
|
https://codepen.io/hello/
|
|
https://codepen.io/pens/#
|
|
|
|
async npm modules
|
|
https://codepen.io/developit/pen/NBbgNb?editors=0010
|
|
// quick tip: an import alias that loads npm modules!
|
|
const npm = p => import(`https://unpkg.com/${p}?module`);
|
|
|
|
(async () => {
|
|
const { h, Component, render } = await npm('preact');
|
|
class Clock extends Component {
|
|
componentWillMount() {
|
|
const tick = () => this.setState({ time: new Date() });
|
|
setInterval(tick, 1000);
|
|
tick();
|
|
}
|
|
render({ }, { time }) {
|
|
return h('time', { title: time+'' }, time.toLocaleTimeString());
|
|
}
|
|
}
|
|
render(h(Clock), document.body);
|
|
})();
|