iH
Size: a a a
iH
p
iH
p
В
p
p
В
iH
᠌
const swapi = (url) => (...path) =>
fetch(`https://swapi.dev/api/${[url, ...path].join('/')}/`)
.then((response) => response.ok
? response.json()
: Promise.reject(`Could not fetch data from ${url}, received ${response.status}`))
const people = swapi('people');
people()
.then((data) => {
console.log('all people received', data)
}).catch(console.error)
const id = 25
people(id)
.then((data) => {
console.log(`person by id ${id} received`, data)
}).catch(console.error)
В
iH
В
iH
SV
function setControlParams(state) {
if (state === 'start') {
states.isStart = true;
radioBtns.style.pointerEvents = 'none';
startBtn.classList.add('disabled');
stopBtn.classList.remove('disabled');
}
if (state === 'end') {
states.isStart = false;
radioBtns.style.pointerEvents = 'auto';
startBtn.classList.remove('disabled');
stopBtn.classList.add('disabled');
}
}
В
В
SV
DE
function setControlParams(state) {
if (state === 'start') {
states.isStart = true;
radioBtns.style.pointerEvents = 'none';
startBtn.classList.add('disabled');
stopBtn.classList.remove('disabled');
}
if (state === 'end') {
states.isStart = false;
radioBtns.style.pointerEvents = 'auto';
startBtn.classList.remove('disabled');
stopBtn.classList.add('disabled');
}
}
function toggleControlParams() {
states.isStart = states.isStart ? false : true;
radioBtns.style.pointerEvents = radioBtns.style.pointerEvents === 'none'
? 'auto'
: 'none';
startBtn.classList.toggle('disabled');
stopBtn.classList.toggle('disabled');
}
SV