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

Allow screenfull to work in non-browser JS environments #99

Merged
merged 1 commit into from Apr 16, 2017

Conversation

@gfx
Copy link
Contributor

@gfx gfx commented Apr 6, 2017

I'd like to this library for my project, which works both on browsers and nodejs. Of course, the fullscreen feature is only meaningful for browsers but some React components, which might include this library, are used for server-side rendering.

This PR just checks window and lets enabled return falsey and it's enough for react components. Now nodejs can load this library with the enabled property:

$ node -e 'console.log(require("./src/screenfull").enabled)'
undefined
@sindresorhus sindresorhus changed the title Make screenfull universal Allow screenfull to work in non-browser JS environments Apr 16, 2017
@sindresorhus sindresorhus merged commit aacee47 into sindresorhus:gh-pages Apr 16, 2017
@gfx gfx deleted the gfx:universal_js branch Apr 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.