Re: Why there is no WebWorker like mechanism for JavaFX

2015-12-08 Thread Benjamin Gudehus
The JavaFX API offers Worker class for long running tasks.

If you want to execute JavaScript code without DOM and JavaFX you can use
the Nashorn JS Virtual machine, which is included in Java 8. I guess the
Nashorn documentation also has examples how it's used with the Java
scripting API.
On Dec 8, 2015 1:50 PM, "Rahman USTA"  wrote:

> I'm really enjoying developing apps in JavaFX, but I think there is a
> limitation point;
>
> When we think HTML5, there is WebWorker to run long-running tasks in
> another process. So, we know WebWorker has no DOM access, it is generally
> used computational needs.
>
> Ok, We can run long-running tasks in JavaFX with many threading services,
> but there is one exception;
>
> There are a lot of JavaScript libraries, and executing them in WebView
> needs JavaFX Application Thread. But, what if your JS code takes long time
> to execute ? Your UI will hang. Is it required to execute JS code in
> WebView if it is not accessing DOM API?
>
> Thanks.
>
> --
> Rahman USTA
> Istanbul JUG
> https://github.com/rahmanusta 
>


Re: Why there is no WebWorker like mechanism for JavaFX

2015-12-08 Thread Rahman USTA
Yes your suggestion is OK in theory but in practice, Nashorn is too slow
without Warmup. I can say Nashorn is 5x to 10x slower than embedded webkit
to run script.

2015-12-08 15:09 GMT+02:00 Benjamin Gudehus :

> The JavaFX API offers Worker class for long running tasks.
>
> If you want to execute JavaScript code without DOM and JavaFX you can use
> the Nashorn JS Virtual machine, which is included in Java 8. I guess the
> Nashorn documentation also has examples how it's used with the Java
> scripting API.
> On Dec 8, 2015 1:50 PM, "Rahman USTA"  wrote:
>
>> I'm really enjoying developing apps in JavaFX, but I think there is a
>> limitation point;
>>
>> When we think HTML5, there is WebWorker to run long-running tasks in
>> another process. So, we know WebWorker has no DOM access, it is generally
>> used computational needs.
>>
>> Ok, We can run long-running tasks in JavaFX with many threading services,
>> but there is one exception;
>>
>> There are a lot of JavaScript libraries, and executing them in WebView
>> needs JavaFX Application Thread. But, what if your JS code takes long time
>> to execute ? Your UI will hang. Is it required to execute JS code in
>> WebView if it is not accessing DOM API?
>>
>> Thanks.
>>
>> --
>> Rahman USTA
>> Istanbul JUG
>> https://github.com/rahmanusta 
>>
>


-- 
Rahman USTA
Istanbul JUG
https://github.com/rahmanusta 


Re: Why there is no WebWorker like mechanism for JavaFX

2015-12-08 Thread Tom Schindl
Let's bring this back on the list - i once more accidentally replied
just to you.

IMHO if you want to execute javascript which is not related to a
browser/html you should run that in a javascript vm like nashorn, ...
and not through the WebView.

Tom

On 08.12.15 15:39, Rahman USTA wrote:
> I handled the issue by using WebWorker in WebView, my main suggestion is
> about JavaFX's threading model, not for a workaround.
> 
> I can try j2v8 if it supports Java Scripting API
> 
> Thanks.
> 
> 2015-12-08 16:24 GMT+02:00 Tom Schindl  >:
> 
> Use j2v8 - it is insanely fast as long as you don't do a lot
> java->js->java calls which you don't
> https://github.com/eclipsesource/j2v8
> 
> Tom
> 
> Von meinem iPhone gesendet
> 
> > Am 08.12.2015 um 14:17 schrieb Rahman USTA
> >:
> >
> > Yes your suggestion is OK in theory but in practice, Nashorn is
> too slow
> > without Warmup. I can say Nashorn is 5x to 10x slower than
> embedded webkit
> > to run script.
> >
> > 2015-12-08 15:09 GMT+02:00 Benjamin Gudehus  >:
> >
> >> The JavaFX API offers Worker class for long running tasks.
> >>
> >> If you want to execute JavaScript code without DOM and JavaFX you
> can use
> >> the Nashorn JS Virtual machine, which is included in Java 8. I
> guess the
> >> Nashorn documentation also has examples how it's used with the Java
> >> scripting API.
> >>> On Dec 8, 2015 1:50 PM, "Rahman USTA"  > wrote:
> >>>
> >>> I'm really enjoying developing apps in JavaFX, but I think there
> is a
> >>> limitation point;
> >>>
> >>> When we think HTML5, there is WebWorker to run long-running tasks in
> >>> another process. So, we know WebWorker has no DOM access, it is
> generally
> >>> used computational needs.
> >>>
> >>> Ok, We can run long-running tasks in JavaFX with many threading
> services,
> >>> but there is one exception;
> >>>
> >>> There are a lot of JavaScript libraries, and executing them in
> WebView
> >>> needs JavaFX Application Thread. But, what if your JS code takes
> long time
> >>> to execute ? Your UI will hang. Is it required to execute JS code in
> >>> WebView if it is not accessing DOM API?
> >>>
> >>> Thanks.
> >>>
> >>> --
> >>> Rahman USTA
> >>> Istanbul JUG
> >>> https://github.com/rahmanusta 
> >
> >
> > --
> > Rahman USTA
> > Istanbul JUG
> > https://github.com/rahmanusta 
> 
> 
> 
> 
> -- 
> Rahman USTA
> Istanbul JUG
> https://github.com/rahmanusta 


-- 
Thomas Schindl, CTO
BestSolution.at EDV Systemhaus GmbH
Eduard-Bodem-Gasse 5-7, A-6020 Innsbruck
http://www.bestsolution.at/
Reg. Nr. FN 222302s am Firmenbuchgericht Innsbruck