Last active
October 21, 2021 21:00
-
-
Save rk/168788377cc6ffd29aa00ed1cde3c416 to your computer and use it in GitHub Desktop.
Million Patch Problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<body> | |
<div id="app"></div> | |
<script type="module"> | |
import { | |
m, | |
patch, | |
/* or any other exports you want to access */ | |
} from 'https://unpkg.com/million?module'; | |
const format = new Intl.DateTimeFormat('en-us', { dateStyle: 'short', timeStyle: 'medium' }); | |
function render() { | |
let now = new Date(); | |
console.log('render', now); | |
patch(document.getElementById('app'), m('div', { id: "app", key: 'app' }, [ | |
m('span', { key: 'ts' }, [format.format(now)]) | |
])); | |
} | |
setInterval(render, 1000); | |
render(); | |
</script> | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<body> | |
<div id="app"></div> | |
<script type="module"> | |
import { | |
m, | |
patch, | |
/* or any other exports you want to access */ | |
} from 'https://unpkg.com/million?module'; | |
const format = new Intl.DateTimeFormat('en-us', { dateStyle: 'short', timeStyle: 'medium' }); | |
function render() { | |
let now = new Date(); | |
console.log('render', now); | |
patch(document.getElementById('app'), m('div', { id: "app" }, [ | |
m('span', {}, [format.format(now)]) | |
])); | |
} | |
setInterval(render, 1000); | |
render(); | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment