約108件1ページ目

日本語のみで絞り込む

2017/4/15 -The async keyword allows await to be used in a function marked as async but it also converts that function into a promise generator. So a ...

2021/8/18 -The static async factory function pattern allows us to emulate asynchronous constructors in JavaScript. At the core of this pattern is the ...

2023/3/27 -It's entirely possible to construct an async constructor in practice. I recommend doing so. It may require departing from the idioms typically ...

2026/1/21 -constructor; const fn = new AsyncFunction( "a", "b", "return await resolveAfter2Seconds(a) + await resolveAfter2Seconds(b);", ); fn(10, 20).

2018/2/13 -FP perspective: Constructor is just a function returning a data structure (which is an object in that case). Such a function can be async, sure.

I have a service and inside its constructor, I make 2 asynchronous calls. However I am getting the message "the await operator can only be used within an async ...

2018/6/29 -The most reasonable solution is with simple async/await. It does not guarantee that constructor will be invoked only once, but at least once.

2024/3/1 -This code snippet will not compile because await is used inside the constructor, which is not allowed in TypeScript (or JavaScript). The ...

2023/12/27 -However, such construction cannot be used in certain scenarios. For instance, using async await keywords is prohibited in constructors.

2017/4/23 -In this post we will discuss some options you have with calling async functions in constructor of your TypeScript classes.