Skip to content

Commit

Permalink
FIX test
Browse files Browse the repository at this point in the history
  • Loading branch information
pubkey committed Dec 23, 2021
1 parent f0a0e44 commit c872596
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ package-lock.json
shelljs_*
test_tmp/
tmp/
.eslintcache
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ babel.config.js
.editorconfig
.eslintignore
.eslintrc.json
.eslintcache
.gitignore
.travis.yml
renovate.json
Expand Down
3 changes: 2 additions & 1 deletion src/broadcast-channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ function _startListening(channel) {
* Not doing this would make messages missing when we send data directly after subscribing and awaiting a response.
* @link https://johnresig.com/blog/accuracy-of-javascript-time/
*/
const minMessageTime = listenerObject.time - 100;
const hundredMsInMicro = 100 * 1000;
const minMessageTime = listenerObject.time - hundredMsInMicro;

if (msgObj.time >= minMessageTime) {
listenerObject.fn(msgObj.data);
Expand Down
2 changes: 1 addition & 1 deletion test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function runTest(channelOptions) {
* 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);
await AsyncTestUtil.wait(200);

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

0 comments on commit c872596

Please sign in to comment.