boucing loading animation https://jsbin.com/xevusopuza/edit?html,css,output
This file contains hidden or 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 makeInterable = (array) => { | |
let nextIndex = 0; | |
return { | |
next: () => { | |
if (nextIndex < array.length) { | |
return {value: array[nextIndex ++], done: false} | |
} else { | |
return {done: true}; | |
} |
progress bar exemples study https://jsbin.com/tufuyifazo/edit?html,console,output
This file contains hidden or 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 button = document.querySelector('button'); | |
button.addEventListener("click", () => resizeWithTroattle(10)); | |
const resizeWithTroattle = throttle(executeResize, 3000); | |
window.addEventListener("resize", () => resizeWithTroattle('test')); | |
function executeResize(number) { | |
console.log("resize: " + number); | |
} | |
function throttle(fn, time) { |
This file contains hidden or 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
type EventTarget<T> = EventTarget & T; | |
interface FormEvent<T> extends Event { | |
target: EventTarget<T>; | |
} | |
function handleSubmit(event: FormEvent<{price: number}>) { | |
event.target.price; | |
} |
OlderNewer