Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Support for native async/await? #715

@elierotenberg

Description

@elierotenberg

Hello,

As said in a previous issue, I'm currently working on a zone.js wrapper for Node designed to provide isolation for HTTP request handlers.

I'm working in Node 7.8, which supports native async/await.
Unless I'm doing something wrong, zone.js doesn't seem to interop nicely with native async functions.

The following piece of code:

const zone = Zone.current.fork({
  name: 'test-zone',
});
zone.run(async () => {
  console.log(Zone.current.name);
  await Promise.resolve();
  console.log(Zone.current.name);
  done();
});

yields:

test-zone
<root>

when using native async/await.
If I transpile the same code using babel-transform-async-to-generator, this yields:

test-zone
test-zone

the latter being the wanted behavior.

Am I doing something wrong? Is native async/await supported by zone.js, and if not, are there plans to support it? (Is it even possible?)

Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions