hammerlab / pileup.js

Interactive in-browser track viewer
Apache License 2.0
278 stars 63 forks source link

Q thinks pileup.js is running under Node #131

Open danvk opened 9 years ago

danvk commented 9 years ago

If you set a breakpoint on q.js:163, you'll see that this block evaluates:

if (typeof process !== "undefined" && process.nextTick) {
    // Node.js before 0.9. Note that some fake-Node environments, like the
    // Mocha test runner, introduce a `process` global without a `nextTick`.
    isNodeJS = true;

    requestTick = function () {
        process.nextTick(flush);
    };
}

Something is defining process.nextTick in the production bundle, and it's making Q behave as though it's running under Node. I suspect this has negative repercussions in terms of error handling.

danvk commented 9 years ago

browserify automatically adds a shim for node's process when it detects that a module uses it.

In this case, it looks like this is confusing Q.