Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window is not defined #30

Open
igorrKurr opened this issue Mar 3, 2016 · 4 comments
Open

window is not defined #30

igorrKurr opened this issue Mar 3, 2016 · 4 comments

Comments

@igorrKurr
Copy link

Hey!
I've tried to use it with react isomorphic tools, and got that error. Is it possible to mock window somehow? Or make it agnostic?

@ZeroCho
Copy link

ZeroCho commented Jun 13, 2016

+1
please make this compatible with react(server-side-rendering) and webpack.
I think wrapping entire codes with

function(window) {
// codes here
}(typeof window === 'object' ? window : this)

will suffice

@leebenson
Copy link

Apologies for the bump, but IMO this is super important. Plenty of iso environments these days with React + Angular that this currently kills.

@sheerun
Copy link

sheerun commented Oct 25, 2016

Until #48 is merged, you can use sheerun/filepicker-js#isomorphic as npm dependency for isomorphic apps (or when testing with mocha)

@osdiab
Copy link

osdiab commented Mar 6, 2017

Additionally this is causing our tests to fail; using jsdom-global to simulate the DOM in test environments, we find that this code causes a failure:

Code

require("jsdom-global")();
require("filepicker-js");

Error

ReferenceError: filepicker is not defined
    at Object.<anonymous> (/node_modules/filepicker-js/dist/filepicker.js:65:1)

The reason is that it is attaching itself to window automatically (that fails if we don't use jsdom-global), and then even with JSDOM window isn't a global in Node so it doesn't see it globally.

This relates to #56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants