Skip to content

Better Electron Support #125

Open
Open
@mattdesl

Description

@mattdesl

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');
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions