getStats
getStats copied to clipboard
Don't put stuff on the `window` when module.exports is available
Polluting the window
object with the getStats
method shouldn't be necessary when module.exports is available. Instead just export the function. This will help users who bundle their javascript with tools like browserify
: http://browserify.org/, or people using webrtc in node.js via wrtc
.
+1. Also, adding support for AMD-loaders like RequireJS would be great.
Yeah. Have a look at https://github.com/umdjs/umd for snippets to use.
Or, just write your code in CommonJS (node.js) style and build with browserify -s getStats -r ./
. This is how simple-peer
does it, for instance: https://github.com/feross/simple-peer/blob/master/package.json#L62
I'm wondering what happened to this issue? It looks like it was added but then removed. Was there a reason for that? Would you be open to pull requests for this feature?