I am connecting to peer.js and then assigning a property with the returned value. Currently I am using a timeout, but I was wondering if there is a way to just assign the property the value when it has been returned? Kind of how observables work.
this.peer = new Peer({ key: 'mykey' });
setTimeout(() => {
this.myId = this.peer.id;
}, 3000);