-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Suggestion for website FAQ: Working Code Example for Loading Bar using a Worker #385
Comments
HI @robcbryant , Thanks for your suggestion. The website is on the gh-pages branch of this repository, so feel to create a PR to it. I'm not sure if the FAQ is the best place for this kind of examples. I'm wondering if it's better to create a examples page that contains the working code. We can make a reference on this page to the github webpage to show the source code that generated this example. Thoughts? |
@pokoli Thanks for the response! I'll try to add a PR to the pages branch with this same post when I have time! It's definitely a bit of code for a FAQ--but having some form of viewable/complete example would be useful. I had to do a bit of digging through here and Stack before figuring out the proper way to do it. Essentially the PapaParse function HAS to be in the worker file or it will not update the progress bar until it finishes--stepping through or otherwise. I noticed on larger files, without it being in a separate worker--it will update the page around 50-60% and then at 100% when it's finished. Keeping it in a separate worker script creates the expected behavior consistently. This may have been the original intent--I just had trouble figuring that out through the existing documentation. |
i have just started and i have no idea how to use it can u help me out how to use papapase |
@ashis0904 please have a look at the website: http://papaparse.com/ where there are some examples and the full docs. P.S: Don't post your doubts to an unrelated issue, just create a new one or use stackoverflow for support. |
I couldn't figure out how to get the worker working and sending out an http request (one of my requirements). But hopefully this helps someone https://github.com/morenoh149/papaparse_csv_progressbar |
I struggled getting this to work--but finally came up with a solution. I noticed some others struggling with the same, so I figured I clean my code I used up and put it here to offer you for the website FAQ:
To create a percent complete loading bar for PapaParse, you will need to use a worker. Create a worker file that contains:
worker.js
After you save that .js file somewhere, then write the main .js file that will be included in the webpage:
main.js
Create both these files, import the main.js script on the webpage, and add the worker.js to the new Worker(url-to-worker) line in the main.js code.
Assuming your element ids are setup properly, and your css is setup properly--this should work. I will say it is much slower than normal--but I prefer the user-end experience to be more informed and wait longer than have no feedback on what they're doing.
Let me know what you think!
The text was updated successfully, but these errors were encountered: