WordPress Developer Ukraine, Kyiv
Broadcast Channel API: Cross-Tab Communication in WordPress

Broadcast Channel API: Cross-Tab Communication in WordPress

BroadcastChannel: keep WordPress tabs in sync Many people work with several tabs of the same site open: the shop in one tab, the cart in another, the WordPress admin in a third. When something changes in one tab, the others show old data until they are reloaded. The BroadcastChannel API sends messages between tabs, windows…
requestIdleCallback and requestAnimationFrame for Non-Blocking JavaScript in WordPress

requestIdleCallback and requestAnimationFrame for Non-Blocking JavaScrip ...

requestAnimationFrame and requestIdleCallback in WordPress scripts The browser has one main thread for JavaScript, layout and painting. A loop that inserts 2,000 table rows, or a scroll handler that reads and writes layout on every event, takes that thread away from everything else, and the page stops reacting. Two scheduling functions help: requestAnimationFrame() runs code…
ES2023 New JavaScript Features You Can Use in WordPress Development

ES2023 New JavaScript Features You Can Use in WordPress Development

ES2023 array methods in WordPress scripts: toSorted, toReversed, with, findLast sort(), reverse() and splice() change the array they are called on. When that array is shared state, for example the list a component renders or the value in a store, a “just for display” sort silently changes the data for every other part of the…