Created
July 27, 2022 11:02
-
-
Save Zirak/d79d46a545274fee00b6d4c386e07a7d to your computer and use it in GitHub Desktop.
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
require('http').createServer((req, res) => { | |
if (req.url === '/1.js') { | |
setTimeout(() => { | |
res.write('console.log(1);'); | |
res.end(); | |
}, 10000); | |
} | |
if (req.url === '/2.js') { | |
res.write('console.log(2);'); | |
res.end(); | |
} | |
if (req.url === '/') { | |
res.write(` | |
<body></body> | |
<script> | |
function loadScript(src) { | |
let scr = document.createElement('script'); | |
scr.src = src; | |
document.body.appendChild(scr); | |
} | |
loadScript('./1.js'); | |
loadScript('./2.js'); | |
</script> | |
`); | |
res.end(); | |
} | |
}).listen(8000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment