Typically when using this
, it points to the class being referenced.
However, in this scenario, this
is set to dataChannel
. How can I make this
point back to VideoService
? Thank you.
export class VideoService {
dataChannel:any;
setupPeerConnection() {
this.dataChannel.onopen = this.dataChannelStateChanged;
}
dataChannelStateChanged() {
// currently 'this' refers to dataChannel, how can we switch it to refer to VideoService
console.log(this);
}
}