Skip to content

Instantly share code, notes, and snippets.

@akirayou
Created April 9, 2022 02:50
Show Gist options
  • Save akirayou/58a33b0eb6faba9fe50656467535b11d to your computer and use it in GitHub Desktop.
Save akirayou/58a33b0eb6faba9fe50656467535b11d to your computer and use it in GitHub Desktop.
<html>
<body>
<img id="a"/>
<script>
var img=document.getElementById("a");
img.addEventListener('load',function(){
img.src="http://atomcam.local/cgi-bin/get_jpeg.cgi?"+ Date.now();
//console.log("laod");
});
const sleep = msec => new Promise(resolve => setTimeout(resolve, msec));
window.addEventListener('load',async function(){
await(sleep(10));
img.src="http://atomcam.local/cgi-bin/get_jpeg.cgi?"+ Date.now();
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment