Use `self` instead of `window`.

This gives web worker support.
Version 1.2.0