Use next tick

`sinon.useFakeTimers` broke tests for some reason, so I used `setTimeout` instead.

```
if (global.postMessage && global.addEventListener) {
```