Whether or not to use a <ahref="/faq#workers">worker thread</a>. Using a worker will keep your page reactive, but may be slightly slower. Web Workers also load the entire Javascript file, so be careful when <ahref="/faq#combine">combining other libraries</a> in the same file as Papa Parse. Note that worker option is only available when parsing files and not when converting from JSON to CSV.
Whether or not to use a <ahref="/faq#workers">worker thread</a>. Using a worker will keep your page reactive, but may be slightly slower.
</td>
</td>
</tr>
</tr>
<tr>
<tr>
@ -749,12 +749,6 @@ var csv = Papa.unparse({
Whether or not the browser supports HTML5 Web Workers. If false, <code>worker: true</code> will have no effect.
Whether or not the browser supports HTML5 Web Workers. If false, <code>worker: true</code> will have no effect.
</td>
</td>
</tr>
</tr>
<tr>
<td><code>Papa.SCRIPT_PATH</code></td>
<td>
The relative path to Papa Parse. This is automatically detected when Papa Parse is loaded synchronously. However, if you load Papa Parse asynchronously (e.g. with RequireJS), you need to set this variable manually in order to use Web Workers. (In those cases, this variable is <i>not</i> read-only and you should set it!)
<h6id="combine">Can I put other libraries in the same file as Papa Parse?</h6>
<h6id="combine">Can I put other libraries in the same file as Papa Parse?</h6>
<p>
<p>
Yes, but then don't use the Web Worker feature unless your other dependencies are battle-hardened for worker threads. A worker thread loads an entire file, not just a function, so all those dependencies would be executed in an environment without a DOM and other <code>window</code> features. If any of those dependencies crash (<code>Cannot read property "defaultView" of undefined</code><ahref="https://github.com/mholt/PapaParse/issues/114">is</a><ahref="https://github.com/mholt/PapaParse/issues/163">common</a>), the whole worker thread will crash and parsing will not succeed.
Yes.
</p>
</p>
@ -96,7 +96,7 @@
<h6id="async">Can Papa Parse be loaded asynchronously (after the page loads)?</h6>
<h6id="async">Can Papa Parse be loaded asynchronously (after the page loads)?</h6>
<p>
<p>
Yes. But if you want to use Web Workers, you'll need to specify the relative path to Papa Parse. To do this, set <ahref="/docs#readonly">Papa.SCRIPT_PATH</a> to the relative path of the Papa Parse file. In synchronous loading, this is automatically detected.
Yes.
</p>
</p>
@ -209,7 +209,7 @@
<h6>Can I use a worker if I combine/concatenate my Javascript files?</h6>
<h6>Can I use a worker if I combine/concatenate my Javascript files?</h6>
<p>
<p>
Probably not. It's safest to concatenate the rest of your dependencies and include Papa Parse in a seperate file. Any library that expects to have access to the <code>window</code> or DOM will crash when executed in a worker thread. Only put <ahref="/faq#combine">other libraries in the same file</a> if they are ready to be used in worker threads.