Browse Source

Do not set IS_WORKER when PapaParse is loaded as a node module

The existing check, that there was no global.document, incorrectly identified PapaParse as running in a web worker when loaded by node. Checking for the availability of the postMessage() method (which we rely on already) fixes this, whilst not exposing us to any more of the WebWorker API.
pull/172/head
Rob Dupuis 10 years ago
parent
commit
ec4c72e5bf
  1. 2
      papaparse.js

2
papaparse.js

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
{
"use strict";
var IS_WORKER = !global.document, LOADED_SYNC = false, AUTO_SCRIPT_PATH;
var IS_WORKER = (!global.document && !!global.postMessage), LOADED_SYNC = false, AUTO_SCRIPT_PATH;
var workers = {}, workerIdCounter = 0;
var Papa = {};

Loading…
Cancel
Save