How to initialize a property of the object the asynchronous function?

let data = new function(){
 (async ()=> {
 return new Promise(resolve => {
 ipcRenderer.send('message', 'ping');
 ipcRenderer.on('reply', (event, arg) => {
resolve(arg);
})
})
});
}

 let obj = {
 data: data
}
 console.log(obj)
June 7th 19 at 14:47
1 answer
June 7th 19 at 14:49
approaches here can be a few
1. to do factory, which will asynchronously return an initialized data object
2. in the object to make the function init, which will run asynchronously and return an initialized object.
3. there must be something else....

Find more questions by tags JavaScript