Skip to content

Commit

Permalink
Merge pull request #21 from h3poteto/fix/message-event
Browse files Browse the repository at this point in the history
  • Loading branch information
ibc authored Aug 30, 2022
2 parents 0e50dfc + 54fbd2c commit 35e961b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/FakeRTCDataChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class FakeRTCDataChannel extends event_target_shim_1.EventTarget {
case 'message':
{
// @ts-ignore
this.dispatchEvent(new event_target_shim_1.Event('message', { data }));
this.dispatchEvent(new MessageEvent('message', { data }));
break;
}
case 'binary':
Expand All @@ -178,7 +178,7 @@ class FakeRTCDataChannel extends event_target_shim_1.EventTarget {
view[i] = buffer[i];
}
// @ts-ignore
this.dispatchEvent(new event_target_shim_1.Event('message', { data: arrayBuffer }));
this.dispatchEvent(new MessageEvent('message', { data: arrayBuffer }));
break;
}
case 'bufferedamountlow':
Expand Down
4 changes: 2 additions & 2 deletions src/FakeRTCDataChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export class FakeRTCDataChannel extends EventTarget implements RTCDataChannel
case 'message':
{
// @ts-ignore
this.dispatchEvent(new Event('message', { data }));
this.dispatchEvent(new MessageEvent('message', { data }));

break;
}
Expand All @@ -315,7 +315,7 @@ export class FakeRTCDataChannel extends EventTarget implements RTCDataChannel
}

// @ts-ignore
this.dispatchEvent(new Event('message', { data: arrayBuffer }));
this.dispatchEvent(new MessageEvent('message', { data: arrayBuffer }));

break;
}
Expand Down

0 comments on commit 35e961b

Please sign in to comment.