elem.onclick
это свойство того HTML-элемента, который поступает аргументом в конструктор. И этому свойству присваивается функция onClick, которая всегда будет иметь контекстом этот элемент, независимо от того как она будет вызвана. Делается это для того, чтобы предотвратить потерю контекста при определенных манипуляциях. Например, если присвоить метод класса другой переменной и вызвать метод из этой переменной - будет потеря контекста (если не забиндить контекст как в случае с onClick). И кстати, перебиндить контекст второй раз нельзя. line-height: ${({lineheight }) => lineheight};
<Li marginRight={marginRight}>
type AsyncThunkConfig = {
/** return type for `thunkApi.getState` */
state?: unknown
/** type for `thunkApi.dispatch` */
dispatch?: Dispatch
/** type of the `extra` argument for the thunk middleware, which will be passed in as `thunkApi.extra` */
extra?: unknown
/** type to be passed into `rejectWithValue`'s first argument that will end up on `rejectedAction.payload` */
rejectValue?: unknown
/** return type of the `serializeError` option callback */
serializedErrorType?: unknown
/** type to be returned from the `getPendingMeta` option callback & merged into `pendingAction.meta` */
pendingMeta?: unknown
/** type to be passed into the second argument of `fulfillWithValue` to finally be merged into `fulfilledAction.meta` */
fulfilledMeta?: unknown
/** type to be passed into the second argument of `rejectWithValue` to finally be merged into `rejectedAction.meta` */
rejectedMeta?: unknown
}
const setError = (state, action)
- вы сами должны это типизировать соответсвенно вашему стейту и action. $.post("/index", {
name: "ТЕСТ",
designation: "FN_TAST",
}, function( data ) { // передаем и загружаем данные с сервера с помощью HTTP запроса методом POST
$( "div" ).html( data ); // вставляем в элемент <div> данные, полученные от сервера
});
export function timerGD() {
let timeGD = new Date("Mar 8 2023 00:00:00");
const timer = () => {
let now = new Date();
let getLeft = timeGD - now;
const titleNY = "Eigth March";
const zero = "0";
let days = Math.floor(getLeft / 1000 / 60 / 60 / 24);
let hours = Math.floor(getLeft / 1000 / 60 / 60) % 24;
let minutes = Math.floor(getLeft / 1000 / 60) % 60;
let seconds = Math.floor(getLeft / 1000) % 60;
if (days < 10) days = zero + days;
if (hours < 10) hours = zero + hours;
if (minutes < 10) minutes = zero + minutes;
if (seconds < 10) seconds = zero + seconds;
document.querySelector(".title-big").textContent = titleNY;
document.querySelector(".timer-days__days").innerHTML = days;
document.querySelector(".timer-hours__hours").innerHTML = hours;
document.querySelector(".timer-minutes__minutes").innerHTML = minutes;
document.querySelector(".timer-seconds__seconds").innerHTML = seconds;
};
if(!GD) {
clearInterval(cl);
return;
}
timer();
const cl = setInterval(timer, 1000);
}
let NY=true;
let GD=true;
let IU=true;
switches.addEventListener("click", (event) => {
if (event.target.id == "NY") {
timerNY();
console.log(1);
GD=false
IU=false
} else {
//?
}
if (event.target.id == "GD") {
timerGD();
console.log(2);
NY=false
IU=false
} else {
//?
}
if (event.target.id == "IU") {
timerIU();
GD=false
NY=false
} else {
//?
}
});
async function fnOne() {
return new Promise(res=>setTimeout(()=>{res(1000)}, 1000))
}
async function fnTwo() {
return new Promise(res=>setTimeout(()=>{res(2000)}, 1200))
}
async function fnThree() {
return new Promise(res=>setTimeout(()=>{res(3000)}, 1400))
}
const allFn = async ()=>{
try {
await fnOne()
console.log('Выполнилась 1-я ф-ция')
const rz = await fnTwo()
console.log('Выполнилась 2-я ф-ция, полученный результат = ', rz)
await fnThree()
console.log('Выполнилась 3-я ф-ция')
}catch (e) {
console.error(e)
}
}
allFn()