I\'m trying to create a constructor for a blogging platform and it has many async operations going on inside. These range from grabbing the posts from directories, parsing t
To avoid the separation of concerns, use a factory to create the object.
class Engine { constructor(data) { this.data = data; } static makeEngine(pathToData) { return new Promise((resolve, reject) => { getData(pathToData).then(data => { resolve(new Engine(data)) }).catch(reject); }); } }