Handle web workers

In web workers, umd tries to access `global` which is undefined. This fixes it using `self`instead.