I am using simple-peer
in angular 7
async ngOnInit() {
try {
if (location.hash === '#init') {
this.peer = new SimplePeer({
initiator: location.hash === '#init'
})
}
else {
this.peer = new SimplePeer()
}
this.peer.on('signal', function (data) {
console.log(JSON.stringify(data));
})
this.peer.on('data', (data) => {
console.log('Received Data: ' + data)
})
} catch (error) {
console.log(error)
}
}
When angular compiler comes on this event
this.peer.on('data', (data) => {
console.log('Received Data: ' + data)
})
then it throws error
When I omit this event
this error is gone
Note: Package versions are as
simple-peer v9.1.2
NPM v6.5.0
Node v10.14.2