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> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<h1>Animated Input Example</h1> | |
<div class="form"> |
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
const respose = axios.get(`http://url.com/api/users`) // async/await required | |
const payload = Object.keys( respose.data || {} ).map( key => { | |
return { | |
...respose.data[key], | |
id: key, | |
} | |
}) | |
/* |
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
const sleep = ms => { | |
return new Promise(resolve => { | |
setTimeout(() => resolve(), ms) | |
}) | |
} | |
sleep(3000).then(() => console.log('After 3 seconds...')) |
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
const fsp = require('fs').promises | |
const readFilePath = './template.html' | |
const writeFilePath = './index.html' | |
const block = ` | |
<script> | |
const eventSource = new EventSource('http://localhost:3000/subscribe') | |
eventSource.onerror = () => { console.log('Error with live-server') } | |
eventSource.onmessage = () => { window.location.reload() } |