Skip to content
This repository has been archived by the owner on May 7, 2022. It is now read-only.

Add WebWorker to run JS #5

Open
Ridermansb opened this issue Aug 30, 2017 · 5 comments
Open

Add WebWorker to run JS #5

Ridermansb opened this issue Aug 30, 2017 · 5 comments

Comments

@Ridermansb
Copy link
Owner

Problem

If you try to execute script like this one:

var x = 1;
while(true) {
  x++;
}

This will block UI since JS has only one thread.

Solution

Use WebWorker to run thease scripts.

@ypahalajani
Copy link

ypahalajani commented Oct 8, 2018

@Ridermansb I am up for this issue. Could you please explain more about the use case of web workers in this project - Like how you want to use the web worker? What for?

I read about the web workers and what are they meant for. I need to understand - what background task do you need to run on a separate thread that does not interrupt the UI thread.

@Ridermansb
Copy link
Owner Author

Hi @ypahalajani .

This project is for running JS with iframe ..

This project is change the way that javascript code is evaluated (instead use iframe, use WebWorker)

@ypahalajani
Copy link

ypahalajani commented Oct 10, 2018

Hi @Ridermansb,

The e.origin checking condition at this line number is preventing the output to be displayed on UI in my local development setup. I am unable to understand the reason for this condition.

@Ridermansb
Copy link
Owner Author

To be honest, I don't remember.

Just remove this condition, I think this was necessary just for iFrame sandbox. But with web worker this is not longer needed

@ypahalajani
Copy link

@Ridermansb There is one problem that I am facing - the dynamic imports in case of worker files.

Currently, the scope of importing an external js file is quite experimental and limited. See this.

However, I tried installing worker-plugin, and as I moved further, I got to know that this plugin requires webpack v4.
Should I update the webpack version?

Let me know your thoughts.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants