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

WIP(async): support native async/await #1140

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

JiaLiPassion
Copy link
Collaborator

@JiaLiPassion JiaLiPassion commented Sep 24, 2018

fix #740, #795.

I think I may find a way to resolve native async/await issue.
The test code below works well.

  async function test() {
            console.log('test');
            return 1;
        }

        async function test1() {
            console.log('before await test', Zone.current.name);
            const result = await test();
            // should keep zone context test
            console.log('after await test', result, Zone.current.name);
        }

        async function test2() {
            console.log('before await test1', Zone.current.name);
            const result = await test1();
            // should keep zone context test
            console.log('after await test1', result, Zone.current.name);
        }
        console.log('begin test');
        Zone.current.fork({name: 'test'}).run(test1);
        // here should be <root> zone.
        console.log('outside test', Zone.current.name);
        Zone.current.fork({name: 'test1'}).run(() => {
            // should be test1 zone.
            console.log('another test', Zone.current.name);
        });

@mhevery, I will continue to add test cases, hope it can work.

@JiaLiPassion JiaLiPassion changed the title feat(async): support native async/await WIP(async): support native async/await Sep 24, 2018
@KrzysztofKarol
Copy link

Hi @JiaLiPassion, do you have any update on this?

@jguyenot
Copy link

Hi @JiaLiPassion have you time to correct integrations fails?

@JiaLiPassion
Copy link
Collaborator Author

@KrzysztofKarol , @jguyenot , there are some cases this solution will not work, I will continue to find another solution, thanks!

@jguyenot
Copy link

Thanks for your time. It's actually impossible to implement lazy loading module with angular 8 and zone.js so it's very important.
Good luck.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

angular with tsconfig target ES2017 async/await will not work with zone.js
4 participants