Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

await constructor typescript

class MyClass {
   private mMember: Something;

   // make private if possible; I can't in TS 1.8
   constructor() {
   }

   public static CreateAsync = async () => {
      const me = new MyClass();
      
      me.mMember = await SomeFunctionAsync();

      return me;
   };
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #await #constructor #typescript
ADD COMMENT
Topic
Name
5+6 =