Ecma International has released ECMAScript 2024. In its fifteenth version, the JavaScript standard implements a number of proposals, some of which have been in the works since 2015. Among other things, the size of the ArrayBuffer
as well as SharedArrayBuffer
It is possible and configuring promises is possible without workarounds.
Advertisement
More flexibility for ArrayBuffer and SharedArrayBuffer
ArrayBuffer
-Constructors can now take additional maximum lengths, which allows buffers to be larger and smaller. This was similar SharedArrayBuffer
This was extended to allow additional maximum lengths and thus increase the size of buffers. Shrinkage is not allowed here because it is not a good idea to shrink shared memory, e.g. This is stated in the proposal on GitHub,
As per the proposal The previous approach — allocating a new buffer and copying — was more inefficient and also fragmented the address space in 32-bit systems.
Configuring Promises without Boilerplate Code
new method means promise Promise.withResolvers
Designed to make developers’ jobs easier. Previously, workarounds were required if you wanted to configure the resolution and rejection behavior of a promise after it was instantiated. This resulted in boilerplate code that developers often had to rewrite.
New static method withResolvers
This should now make this boilerplate code unnecessary, since it outputs a promise including its resolution and rejection functions:
const { promise, resolve, reject } = Promise.withResolvers();
There is also a flag in addition v
Regular expressions found their way into ECMAScript 2024. It is used to create regular expressions with additional functions for working with string sets. Methods for collecting data are now available Object.groupBy
as well as Map.groupBy
Ready and Atomics.waitAsync
The method allows asynchronous waiting for changes to shared memory.
Details about ECMAScript 2024 and ongoing proposals
Proposals involved in the new standard have reached stage 4 in the proposal process can be seen on GitHub. All the other ECMAScript suggestions at various levels can also be found there. In early 2024, TC39 – the technical committee for the standardization of JavaScript – introduced the new level 2.7, which matches the previous level 3.
More information about the new standard is available Available on the Ecma International website,
(May)