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 App = () => { | |
const [firstCount, setFirstCount] = useState(0); | |
const [secondCount, setSecondCount] = useState(0); | |
const handleClick = () => { | |
setFirstCount((count) => count - 1); // Перерисовка не вызывается | |
setSecondCount((count) => count - 0.5); // Перерисовка не вызывается | |
// Перерисовка - пакетные обновления (updates batched) | |
}; | |
const alternativeHandleClick = () => { |
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 machineConfig = { | |
id: 'signIn', | |
initial: 'dataEntry', | |
states: { | |
dataEntry: { | |
on: { | |
ENTER_EMAIL: {}, | |
ENTER_PASSWORD: {}, | |
EMAIL_BLUR: {}, | |
PASSWORD_BLUR: {}, |
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
dataEntry: { | |
on: { | |
ENTER_EMAIL: {} | |
} | |
} |
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
emailErr: { | |
on: { | |
ENTER_EMAIL: { | |
target: 'dataEntry' | |
} | |
} | |
} |
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 machineConfig = { | |
id: 'signIn', | |
initial: 'dataEntry', | |
states: { | |
dataEntry: {}, | |
awaitingResponse: {}, | |
emailErr: {}, | |
passwordErr: {}, | |
serviceErr: {}, | |
signedIn: {}, |
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
Show hidden characters
// Файл "tsconfig.json": | |
// - устанавливает корневой каталог проекта TypeScript; | |
// - выполняет настройку параметров компиляции; | |
// - устанавливает файлы проекта. | |
// Присутствие файла "tsconfig.json" в папке указывает TypeScript, что это корневая папка проекта. | |
// Внутри "tsconfig.json" указываются настройки компилятора TypeScript и корневые файлы проекта. | |
// Программа компилятора "tsc" ищет файл "tsconfig.json" сначала в папке, где она расположена, затем поднимается выше и ищет в родительских папках согласно их вложенности друг в друга. | |
// Команда "tsc --project C:\path\to\my\project\folder" берет файл "tsconfig.json" из папки, расположенной по данному пути. | |
// Файл "tsconfig.json" может быть полностью пустым, тогда компилятор скомпилирует все файлы с настройками заданными по умолчанию. | |
// Опции компилятора, перечисленные в командной строке перезаписывают собой опции, заданные в файле "tsconfig.json". |
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
'use strict'; | |
const nodemailer = require('nodemailer'); | |
const http = require('http'); | |
// const https = require('https'); // Этот модуль если запрос по протоколу https | |
const targetLink = 'http://nekrasovka.ru/afisha/19-01-2019/1224'; | |
const timePeriod = 1000 * 60 * 5; // будем проверять каждые 5 минут | |
let index; |
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 nodemailer = require('nodemailer'); | |
// HTML контент письма | |
const output = ` | |
<p>Срочно регистрируйся! 🤓</p> | |
`; | |
// Опции отправки почты | |
let mailOptions = { | |
from: '[email protected]', // почта отправителя |
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 http = require('http'); | |
const targetLink = 'http://nekrasovka.ru/afisha/19-01-2019/1224'; | |
let index; | |
function setMonitor () { | |
// Тут делаем запрос и формируем тело ответа | |
http.get(targetLink, (res) => { | |
// Так как тело ответа прилетает порциями, | |
// кладем все в массив и затем формируем строку ответа |
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
node mail test | |