Skip to content

Instantly share code, notes, and snippets.

View RusJstudent's full-sized avatar

Sergey RusJstudent

View GitHub Profile
@dSalieri
dSalieri / index.md
Last active July 10, 2024 07:37
Promise изнутри

Автор: dSalieri

Версия ECMAScript, используемая в объяснении: Draft ECMA-262 / June 24, 2022

Версия WHATWG, используемая в объяснении: Living Standard - 22 August 2022

Последнее изменение документа: 13.12.2022


@dSalieri
dSalieri / index.md
Last active July 2, 2024 14:06
Аргумент resolve внутри Promise и Promise.resolve работают ли они одинаково?

Вопрос: Есть две цепочки promise, которые выводят сообщения в консоль. Первый выводит: tick1, tick2, tick3. Второй: tick3, tick1, tick2

Код 1:

/// Код 1
const p = new Promise(resovle => setTimeout(resovle));

new Promise(resolve => resolve(p)).then(() => {
    console.log("tick 3");
});
@paulirish
paulirish / what-forces-layout.md
Last active July 24, 2024 14:23
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent