BT

Facilitating the spread of knowledge and innovation in professional software development

Contribute

Topics

Choose your language

InfoQ Homepage News Deno 1.10 Released with Shared Wasm Memory and Web Storage Support

Deno 1.10 Released with Shared Wasm Memory and Web Storage Support

Bookmarks

The Deno team recently released Deno 1.10 with shared WASM memory support, implementation of Web Storage API, remote import maps, improvements to the built-in test runner, and more.

Deno 1.10 now supports WebAssembly atomics and shared memory, following the path of Chrome and Firefox, which enable the previous features by default:

const memory = new WebAssembly.Memory({
  initial: 1,
  maximum: 10,
  // enables atomics and allows for shared array buffers as WASM memory the backing store
  shared: true,
});
console.assert(memory.buffer instanceof SharedArrayBuffer);

The new Deno release additionally supports the browser Web Storage API. The Web Storage API provides alternative mechanisms to cookies that allow persisting a small quantity of key/value pairs (up to 5 MB for local storage). These mechanisms are available in the browser via the Window.sessionStorage and Window.localStorage properties. In Deno, localStorage and sessionStorage can be used directly, without permissions as follows:

// kv.ts

const key = Deno.args[0];

if (key === undefined) {
  // if user passes no args, display number of entries
  console.log(localStorage.length);
} else {
  const value = Deno.args[1];

  if (value === undefined) {
    // if no value is specified, return value of the key
    console.log(localStorage.getItem(key));
  } else {
    // if value is specifed, set the value
    localStorage.setItem(key, value);
  }
}

The storage is keyed by origin (--location option). The following executions of the previous script showcase how data is persisted across invocations:

$ deno run --location https://example.com ./kv.ts
0
$ deno run --location https://example.com ./kv.ts foo bar
$ deno run --location https://example.com ./kv.ts foo
bar
$ deno run --location https://example.com ./kv.ts
1

Deno 1.10 lets developers fetch import maps remotely:

$ deno install --import-map=https://example.com/import_map.json -n example https://example.com/mod.ts


Import maps
, recently added in Chrome 89, specify what URLs get fetched by JavaScript import statements and import() expressions (e.g., import moment from "moment"). Import maps thus allow remapping imports without modifying the source code.

Deno’s built-in test runner also sees significant improvements. While tests continue to be run serially by default, developers can use the --jobs option to specify the number of concurrent threads running tests. Test modules are run in isolation with a new runtime instance for each of the modules. Deno.test also supports specifying test case permissions and watching for file changes that are relevant to a test case (--watch option).

Deno users can upgrade by running deno upgrade in a terminal. Deno 1.10 contains additional features, bug fixes, and performance improvements. Developers are encouraged to review the full list and description of new features and stabilized APIs.

Deno is open-source software available under the MIT license. Contributions are encouraged via the Deno Project and should follow the Deno contribution guideline.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.