Closed chadly closed 9 years ago
This is great and I like the idea, but I have one suggestion/change. Rather than naming the argument root
, just name it window
.
This serves two purposes.
window
object in the browser (despite being global
when run from the node CLI)window
in your update here.Ahh, nice catch. Yeah, that is a better idea. I renamed root
to window
.
Looks good, merging now. Will push to npm tonight.
Latest version with these updates is now up on npm -- v0.2.8
Thanks!
I'm running mocha tests in my app where I use crosstab. I run the mocha tests with the CLI without a browser, e.g.
mocha tests
wheretests
is the folder with all my tests in it.Crosstab fails the tests due to it accessing
navigator
andwindow
directly. It complains aboutnavigator
beingundefined
. If it could just get past this step, it wouldn't be a problem as I am using sinon to mock the class that is using crosstab.Anyway, I updated the UMD wrapper in crosstab to pass the current context (
this
- which will beglobal
in node andwindow
in the browser) down so that crosstab can get past that initial useragent check without blowing up when run from node.