Add WebWorker compatibility

This PR adds WebWorker compatibility.

WebWorkers don't have access to a global window object, but a self object which has references to all necessary objects (e.g. IDBFactory etc.).

I've wrapped the original function into a function which takes the global scope, which will evaluate to window if IDBWrapper is included outside of WebWorkers, and to self if imported using importScript.

Feedback would be greatly appreciated. 
Cheers, Raphael