3

Does anyone know if there is a way to force a new JavaScript thread for a new window?

I have an ExtJs application whose render steps are slaughtering user interaction. I can't toss the whole Ext application right now, so I've devised a way to make use of localStorage to manage passing events between browser windows and replacing a high activity data entry portion of the application with an Angular2 app spawned in a new window from the Ext app.

While things are performing wonderfully on the Angular2 side of things, when the parent window with the Ext application hangs during a render step, the window with the Angular2 application hangs as well causing users to lose keystrokes (which is bad).

Ideally being able to divorce the Angular2 app's JavaScript thread from the Ext one is what I would like to do.

Does anyone know if this is possible?

4
  • 1
    Why not just spawn a worker instead ? Commented Aug 8, 2016 at 19:14
  • For which? A worker does me no good unless there is something I'm missing in how workers work? While the ExtJS app is in its render step it locks the main JS thread, which is the only thread that can interact with the DOM locking up both windows (aka data entry occurring in the other window). Commented Aug 8, 2016 at 19:26
  • Don't think there would be a cross-browser way to do it. Do note that if you were to do this while I was browsing your site, I'd be really annoyed - I use Firefox and opening a new window seems to be terribly expensive for it (my addons don't seem to help) - opening a new window tends to cause all browser instances to hang for up to 10 seconds at a time. All because you thought window.open would reduce the hanging. Commented Aug 8, 2016 at 19:28
  • This is a large enterprise ExtJS 4.2 single page application over PHP and RPG, not a consumer facing website. Sadly this is more performant than performing the data entry in the actual application. Commented Aug 8, 2016 at 20:32

3 Answers 3

0

Javascript is not a threaded language. But, there are some alternatives to use in order to run functions without blocking the UI. Most wide-spread solution is to make use of WindowTimer functions.

Read further upon it here: How can I create an Asynchronous function in Javascript?

Sign up to request clarification or add additional context in comments.

1 Comment

JavaScript isn't a threaded language explicitly (excluding workers), your browser will maintain different JS threads, but if you're saying there is no way to force this in any browser that you're aware of I will accept your answer.
0

Actually it depends on browsers on how they want to tackle it.... Also depends on how you opened browser using what parameters. If the parent and child are coupled then it might be an issue. While if the parent and child are independent then you might have some help.

Check this answer https://stackoverflow.com/a/17169863/2219162

1 Comment

Yes, this is correct. The question is does anyone know of any way to force a new thread in any browser?
0

There is no way to force a new JavaScript main thread for a new window.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.