Need to Node – Volume 69 - NodeSource

The NodeSource Blog

Need to Node – Volume 69

In this special edition of Need to Node, you can find the top 10 highlights in Node.js in 2020!

Need to Node is a weekly bulletin designed to keep you up-to-date with the latest news on the Node.js project, events and articles. You are always welcome to collaborate and participate. Please let us know if we missed a piece of content you think should be included!

Awesome Articles, Links, and Resources

10) Node.js 14 became LTS, and Node.js 15 is current.

9) EventTarget:

Events and event handling are central to JavaScript. An EventTarget is a JavaScript object that is associated with a list of event types, i.e. strings, on which event listeners can be registered for one of those event types and on which events can be dispatched. When an event of a given type is dispatched, the event listeners for that event type are called.

In other words EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them! Find out more in this article

8) Experimental Support for WebAssembly System Interface:

In 2020, Node.js added experimental support for WebAssembly System Interface (WASI). This means that if you are running a recent version of Node.js, you can natively start a WASI instance and execute WebAssembly modules in a sandboxed environment, and granularly pass environment variables, arguments, or file handles to the process running in the module.

To learn more, you can check this article.

7) QUIC Protocol:

This new experimental UDP-based transport protocol is intended to ultimately replace the use of TCP for all HTTP traffic.

UDP is notoriously unreliable, with packets frequently being lost, reordered, duplicated, and so forth. UDP does not include any of the reliability and sequencing guarantees of TCP that are strictly required for a higher-level protocol such as HTTP. That is where QUIC comes in.

The QUIC protocol defines a layer on top of UDP that introduces error handling, reliability, flow control, and built-in security (via TLS 1.3) to UDP. And it’s super useful because QUIC introduces Inherent Flexibility, Security & Reduced Latency.

You can find more in this blog post..

6) AbortController:

When we are working with Fetch or other async functions in JavaScript, sometimes, we may want to cancel them. So, AbortController provides a standardized and easy way to cancel asynchronous tasks. The AbortController interface represents a controller object that allows you to abort one or more requests as and when desired.

Find out more here.

5) AsyncLocalStorage:

Node.js v 14 which was released in April, brought AsyncLocalStorage support.

Because Node is single threaded, you do not have the benefits of thread local storage, so to store data in asynchronous contexts we can use AsyncLocalStorage. To learn more about this topic you can read this great article here.

4) Node.js crashes on unhandledRejections by default! (v15 onwards):

Before when you had an unhandled Rejection, your node.js application will still be running and it will just show a warning message like this:
browser-unhandled-rejection-native

This is not a good practice because you can just ignore that error and that can potentially cause problems later and bring unexpected results.

Now, from Node.js version 15 onwards, if you have an unhandled rejection your application will automatically crash, this is a default best practice because now all unhandled rejections will be addressed (not just ignored) and it will avoid future problems.

3) Event Loop Utilization:

Event Loop Utilization (or ELU) is crucial to see if an application is reaching hardware limitations. The simplest definition of event loop utilization (or ELU) is the ratio of time the event loop is not idling in the event provider to the total time the event loop is running.

This is quite a complex feature, but you can check out this amazing blog post to learn more.

2) ECMAScript Modules became stable:

In 2017, ECMAScript Modules was introduced to Node.js as an experimental feature. This year it finally became stable, so you don’t have to use the experimental flag (--experimental-modules) anymore.

ECMAScript Modules are known for their import and export statements. They are the official standard format to package JavaScript code for reuse. Modules are defined using a variety of import and export statements. This means that now Node.js supports both CommonJS and ES modules and no more transpiling, no more difficulties with import and export.

You can find more information in this article..

1) As always the awesome community:

There has been a great and a ton of work done in Node.js this year. As we saw there were major features and implementations added to Node.js. and this wouldn’t have been possible without the amazing community that supports the project. Thank you for all you do and we hope the project will keep growing and being used by millions of people.

If you think we missed something that should be in the top 10, send us a DM! Very excited about what the next year will bring!

One Last Thing...

If you find any Node.js or JavaScript related content over the next week (or beyond!), never hesitate to reach out to us on Twitter at @NodeSource to share and get it included in Need to Node - our DMs are open if you don’t want to share publicly!

The NodeSource platform offers a high-definition view of the performance, security and behavior of Node.js applications and functions.

Start for Free