Skip to content

Commit

Permalink
FIX missing events directly after addEventListener() 2
Browse files Browse the repository at this point in the history
  • Loading branch information
pubkey committed Dec 23, 2021
1 parent 91a3e64 commit f0a0e44
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,13 @@ function runTest(channelOptions) {
channel1.postMessage('foo1');
channel1.postMessage('foo2');

/**
* We have to wait 200ms here because only 'too old' messages should be filtered out.
* Becuase the JavaScript time precision is not good enough, we also emit messages that are only a bit off.
* This ensures we do not miss out messages which would be way more critical then getting additionals.
*/
await wait(200);

const emitted = [];
channel2.onmessage = msg => emitted.push(msg);

Expand Down

0 comments on commit f0a0e44

Please sign in to comment.