Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function _RTCPeerConnection(...args: any[]) {
/* eslint-disable indent, no-invalid-this */
RTCPeerConnection.apply(this, args);
this.onaddstream = (...args) => // eslint-disable-line no-shadow
(this._onaddstreamQueue
? this._queueOnaddstream
: this._invokeOnaddstream)
.apply(this, args);
// Shadow RTCPeerConnection's onaddstream but after _RTCPeerConnection has
// assigned to the property in question. Defining the property on
// _RTCPeerConnection's prototype may (or may not, I don't know) work but I
// don't want to try because the following approach appears to work and I
// understand it.
// $FlowFixMe
Object.defineProperty(this, 'onaddstream', {
configurable: true,
function _RTCPeerConnection() {
RTCPeerConnection.apply(this, arguments);
this.onaddstream = function () {
return (
(this._onaddstreamQueue
? this._queueOnaddstream
: this._invokeOnaddstream)
.apply(this, arguments));
};
// Shadow RTCPeerConnection's onaddstream but after
// _RTCPeerConnection has assigned to the property in question.
// Defining the property on _RTCPeerConnection's prototype may (or
// may not, I don't know) work but I don't want to try because the
// following approach appears to work and I understand it.
Object.defineProperty(this, 'onaddstream', {
configurable: true,
enumerable: true,