HenrikJoreteg / webrtcsupport

Browser module to detect support for WebRTC and extract proper constructors.
55 stars 33 forks source link

feat: switch window for self for webworker compatibility #30

Open dryajov opened 7 years ago

dryajov commented 7 years ago

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.

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

daviddias commented 7 years ago

@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.