doc write, bar width examples
https://developers.google.com/web/fundamentals/performance/rendering/
for(let i = 0; i < 100; i += 1){
bar.style.width = i + "%";
}
recalculates styles of each element
recalculates how elements affect each other
Each layer is drawn graphically in memory
All layers combined
(opacity, order)
//line-by-line execution
let const a = 5;
a += 1;
//function calls
const double a => a*2
, four = double(2)
, five = 5;
//loops
for(let i = 0; i < 10; i += 1){
log(i);
}
log(i)
In general, asynchronous (from Greek asyn-, meaning "not with," and chronos, meaning "time") is an adjective describing objects or events that are not coordinated in time.
Async
Code
Result
...
...
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
Function which provides a easy and flexible API for accessing network resources
(is asynchronous)
fetch(something)
.then(a function which handles data)
.catch(a function which handles errors)
fetch("http://www.domain.com/api/v1/people/30")
.then(response => {
console.log("I got the data!");
const prettyData = response.map(...).filter(...)
render(prettyData);
})
.then(...) //chainable
.catch(response => {
console.log("there was a network error!");
render(errorMessage);
});
Reddit API Example
https://weber.instructure.com/courses/422412/assignments/3159375