Код: Выделить всё
pressКод: Выделить всё
const type = async (text: string) => {
const characters = text.split("");
setTyped("");
await delay(500);
for (const character of characters) {
setTyped((prev: string) => prev + character);
await press(character, 100);
await delay(100);
}
};
Код: Выделить всё
pressКод: Выделить всё
const press = async (key: string, duration: number) => {
pressDown(key);
await delay(duration);
pressUp(key);
};
const pressDown = (key: string) => {
setPressed(key);
};
const pressUp = (key: string) => {
setPressed(null);
};
Код: Выделить всё
const type = async (text: string) => {
if (text.length === 0) return;
setTyped((prev) => prev + text[0]);
await press(text[0], 100)
.then(() => {
return delay(100);
})
.then(() => {
type(text.slice(1));
});
};
Спасибо!
Подробнее здесь: https://stackoverflow.com/questions/785 ... ion-on-ios
Мобильная версия