SHARE
TWEET

Untitled

a guest Jun 24th, 2019 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class DeviceManager {
  2. constructor() {
  3.     this.deviceList = [];
  4. }
  5.  
  6. async buildDevices() {
  7.     const deviceNames = await this.getDeviceNames();
  8.  
  9.     deviceNames.forEach(async name => {
  10.       const device = new Device(name);
  11.       await device.build();
  12.       console.log(device); // This outputs the device as expected!
  13.       this.deviceList.push(device); // However, the device doesn't end up in this array?
  14.     });
  15.   }
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top