Skip to content

Instantly share code, notes, and snippets.

@stepanmas
Created October 23, 2020 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stepanmas/85f7eaf8a1c8e1389eaccc3e91cb11e1 to your computer and use it in GitHub Desktop.
Save stepanmas/85f7eaf8a1c8e1389eaccc3e91cb11e1 to your computer and use it in GitHub Desktop.
Очередь синхронного кода (callstack)
Очередь микрозадач (Promise)
Очередь макрозадач (setTimeout() и setInterval() или AJAX-запросы)
Отдельная очередь браузера для отрисовки содержимого (requestAnimationFrame)
requestAnimationFrame(() => console.log('1 animation frame'));
setTimeout(() => console.log('2 timeout'), 0);
Promise.resolve().then(() => console.log('3 promise'));
console.log('4 sync');
// 4 sync
// 3 promise
// 1 animation frame
// 2 timeout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment