Skip to content

Better Electron Support #125

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

Open
mattdesl opened this issue Feb 1, 2016 · 2 comments
Open

Better Electron Support #125

mattdesl opened this issue Feb 1, 2016 · 2 comments

Comments

@mattdesl
Copy link

mattdesl commented Feb 1, 2016

Thanks to #79 this supports Electron already (an environment where we are both in a "browser" and in "node").

It might be good to do the same logic here, so that fs is used when possible rather than synchronous XHR (which is deprecated anyways):

if (isInBrowser()) {
var xhr = new XMLHttpRequest();
xhr.open('GET', path, false);
xhr.send(null);
var contents = null
if (xhr.readyState === 4 && xhr.status === 200) {
contents = xhr.responseText
}
}
// Otherwise, use the filesystem
else {
var contents = fs.readFileSync(path, 'utf8');
}

@julien-f
Copy link
Collaborator

julien-f commented Feb 1, 2016

Good idea :)

PR are welcome :p

@niieani
Copy link
Contributor

niieani commented Jul 4, 2016

#140

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

3 participants