self is a safer and more portable reference to global context than window, with virtually the same browser version/history support. Using self should allow detecting webrtc capabilities with this library in web/serviceworker environments without breaking.
Fixing this would also allow running IPFS in webworkers.
@fippo, @HenrikJoreteg can we get this one merged? I can also create another module following your suggestion here, but I would rather than have one utility rather than two to achieve the same goal.
self
is a safer and more portable reference to global context thanwindow
, with virtually the same browser version/history support. Usingself
should allow detecting webrtc capabilities with this library in web/serviceworker environments without breaking.Fixing this would also allow running IPFS in webworkers.
For background, here are a few pointers: https://github.com/eslint/eslint/issues/8229 https://github.com/ipfs/js-ipfs/issues/725 https://github.com/ipfs/js-ipfs/issues/728