WordPress Developer Ukraine, Kyiv
JavaScript Explicit Resource Management: using and Symbol.dispose

JavaScript Explicit Resource Management: using and Symbol.dispose

Explicit resource management in JavaScript: using and Symbol.dispose Cleanup code is easy to forget on the error path: an event listener that is never removed, an IntersectionObserver that keeps running, a lock that stays taken because an exception jumped over the release(). try/finally solves it, but nested finally blocks for three resources are hard to…
JavaScript Set Methods: union, intersection, difference in ES2025

JavaScript Set Methods: union, intersection, difference in ES2025

Set methods in JavaScript: union, intersection, difference Comparing two lists of IDs is everyday work in admin scripts: which posts are selected but not yet saved, which tags two posts share, which users were added since the last sync. Until recently, every project wrote the same helpers with filter() and includes(). ES2025 added the set…
JavaScript Decorators: Memoize, Log, and Deprecated for WordPress JS

JavaScript Decorators: Memoize, Log, and Deprecated for WordPress JS

JavaScript decorators in WordPress build tooling: memoize, log, deprecate Decorators wrap class methods with extra behavior declared next to the method: @memoize caches results, @deprecated warns callers, @logged traces calls. The proposal has been at Stage 3 since 2022 and its final form is stable, but no browser runs decorators natively yet. In WordPress projects…
JavaScript Iterator Helpers: Lazy Transformations on Large Datasets

JavaScript Iterator Helpers: Lazy Transformations on Large Datasets

Iterator helpers: map, filter and take without building arrays array.filter().map().slice( 0, 10 ) is readable, but on a large list it does all the work for every element and builds two full intermediate arrays, only to keep ten items at the end. ES2025’s iterator helpers add map(), filter(), take(), drop(), flatMap() and friends to iterators.…
JavaScript Temporal API: Modern Date and Time Handling

JavaScript Temporal API: Modern Date and Time Handling

The Temporal API: dates and times without the Date pitfalls JavaScript’s Date is a timestamp with a confusing interface: months start at 0, objects are mutable, there is no date without a time and no time zone other than UTC and the browser’s own. A booking widget that shows “Tuesday 10:00 in Berlin” to a…
JavaScript WeakRef and FinalizationRegistry: Memory-Safe Caches

JavaScript WeakRef and FinalizationRegistry: Memory-Safe Caches

WeakRef and FinalizationRegistry: caches that do not leak memory A cache in a long-living admin page (a block editor plugin, a dashboard that runs all day) easily becomes a memory leak: every object put into a Map stays alive as long as the map does, even when nothing else uses it. WeakMap solves this for…
ES Modules in WordPress 6.5: wp_enqueue_script_module()

ES Modules in WordPress 6.5: wp_enqueue_script_module()

Script modules in WordPress: wp_enqueue_script_module() For a long time, WordPress could only load classic scripts. Writing import and export in a theme meant a bundler, or a script_loader_tag filter that added type="module" by hand, with no way to share modules between plugins. WordPress 6.5 added the Script Modules API: modules are registered with an ID,…
JavaScript Navigation API: Intercept and Control Page Transitions

JavaScript Navigation API: Intercept and Control Page Transitions

The Navigation API: intercept navigations in a theme without a router library A theme that loads pages of a portfolio or a filtered list with fetch() needs three things: intercept the link click, update the URL with history.pushState(), and handle the back button with popstate. The History API makes this fiddly: popstate does not fire…