Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. 'use strict';
  2.  
  3. const HTML = `
  4. <!doctype html>
  5.  
  6. <html lang="en">
  7. <head>
  8. <meta charset="utf-8">
  9. <title>Hello World</title>
  10. <meta name="description" content="The HTML5 Herald">
  11. <meta name="author" content="SitePoint">
  12. </head>
  13. <body>
  14. <script>
  15. var clicked = function() {
  16. var adiv = document.createElement("div");
  17. adiv.innerHTML = "HELLO WORLD";
  18. adiv.id = "asyncDiv";
  19.  
  20. var abutton = document.createElement("button");
  21. abutton.innerHTML = "ASYNC BUTTON";
  22. abutton.type = "button";
  23. abutton.id = "asyncButton"
  24.  
  25. var anOption1 = document.createElement("option");
  26. anOption1.innerHTML = "ONE"
  27. var anOption2 = document.createElement("option");
  28. anOption2.innerHTML = "TWO"
  29.  
  30.  
  31. setTimeout(function() {
  32. document.getElementById("magic").appendChild(adiv);
  33. document.getElementById("magic").appendChild(abutton);
  34. document.getElementById("asyncSelect").appendChild(anOption1);
  35. document.getElementById("asyncSelect").appendChild(anOption2);
  36. document.getElementsByTagName("title")[0].innerHTML = "NEW TITLE";
  37. }, 2000);
  38. }
  39. </script>
  40. <div id="test">test</div>
  41. <div id="magic"></div>
  42. <select id="asyncSelect">
  43. </select>
  44. <button type="button" id="async" onclick="clicked()">CLICK ME</button>
  45. </body>
  46. </html>
  47. `;
  48.  
  49.  
  50. const APP = require('express')();
  51.  
  52. APP.get('/', (req, res) => {
  53. res.send(HTML);
  54. });
  55.  
  56. setTimeout(() => {
  57. const server = APP.listen(5000, () => {
  58. console.log('---------------------------');
  59. console.log('TEST APPLICATION IS RUNNING');
  60. console.log('---------------------------');
  61. });
  62. }, 2000)
  63.  
  64. /**
  65. * Close the webserver in case Antics crashes
  66. */
  67. setTimeout(function() {
  68. server.close();
  69. }, 60000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement