better? 
```js
else if (numLoaded === totalToBeLoaded && typeof self.onfinish === 'function') {
  window.setTimeout(self.onfinish);
}
```