Press "Enter" to skip to content

Web development: Deno 1.14 stabilizes the native server-side WebSocket API

The runtime for JavaScript and TypeScript Deno was released in version 1.14. She is working on stabilizing various APIs, and the process has already been completed for one of them: the native server-side WebSocket API introduced in Deno 1.12 Deno.upgradeWebSocket() now has no --unstable-Flag more.

The newly introduced web platform API is one of the currently unstable APIs URLPattern to match URLs or parts of them against a pattern. It is intended to be a built-in alternative to the library path-to-regexp and has a similar syntax.

It also offers URLPattern however, more options, as any part of a URL can be matched, including the protocol, host name, or path name. The API should go into stable mode with the next version 1.15 – in line with the stabilization of Chrome 95. The Deno blog shows a code example:

const pattern = new URLPattern({ pathname: "/books/:id" });

console.log(pattern.test("https://example.com/books/123")); // true
console.log(pattern.test("https://example.com/books/123/456")); // false
console.log(pattern.test("https://example.com/books")); // false

console.log(pattern.exec("https://example.com/books/123").pathname); // { input: "/books/123", groups: { id: "123" } }

The API for OS signals Deno.Signal should also soon be considered stable. In the course of this, the Deno team made the change that string identifiers are now also permitted, as can be seen in a before-and-after comparison. In addition, the Deno.signals Namespace.

for await (const _ of Deno.signal(Deno.Signal.SIGTERM)) {
  console.log("got SIGTERM!");
}

for await (const _ of Deno.signal("SIGTERM")) {
  console.log("got SIGTERM!");
}

Deno 1.14 supports the current TypeScript version 4.4, which brought with it a deeper control flow analysis for determining types. The supported version of the JavaScript engine V8 has been increased to 9.4, which among other things introduced Class Static Initialization Blocks. Some new web crypto APIs are also on board in Deno 1.14.

The open source runtime Deno stands for macOS, Windows and Linux ready for download. Provide further details on version 1.14 die Release Notes im Deno-Blog as an overview of all changes on GitHub.


(May)

Article Source

Disclaimer: This article is generated from the feed and not edited by our team.