Does anyone know how to execute asynchronous processing without Server module?
I want to show a loading image while loading a reusable part that is a large size and takes a long time to draw on the browser.
To do that, I understand that showing the image and loading the part must be in separate threads, which requires asynchronous processing.
This can be achieved by ExecuteAsync Server module, but I don't need I/O to an application database, so I want to reduce the overhead of calling Server module.
If anyone knows a good idea or how to do this, please let me know.
Thanks,
Taku Izumi
How to execute asynchronous processing without Server module
-
Taku Izumi
- Posts: 70
- Joined: Thu Dec 15, 2016 2:03 pm
Re: How to execute asynchronous processing without Server module
I would think that running asynchronous code without the server module, will involve some javascript, meaning, you will need to create your own javascript code, put it in a widget, so you can reuse/call it from your LANSA webpage.
Javascript code like these most likely:
https://developer.mozilla.org/en-US/doc ... ntroducing
Javascript code like these most likely:
https://developer.mozilla.org/en-US/doc ... ntroducing
Re: How to execute asynchronous processing without Server module
OR you could do something like:
Why this works:
the Method StartLoadingRP makes the #LoadingImage VISIBLE when the routine ENDS.
the Signal will be processed as soon as possible (its the same as the technique described for javascript).
By using Signals, you give the browser time to show things.
you can also use a #PRIM_TIMR to set a delay before things happen:
In this case, the Timer fires 5000ms after the LoadRP ends, which *may* be the time you need to draw to the screen.
B.
Code: Select all
Define_Evt Named(StartedLoading)
Define_Evt Named(FinishedLoading)
Mthroutine Name(StartLoadingRP)
#LoadingImage.Visible := True
Signal StartedLoading
Endroutine
Evtroutine Handling(#Com_owner.StartedLoading)
#Com_self.LoadRP
Endroutine
Evtroutine Handling(#Com_owner.FinishedLoading)
#LoadingImage.Visible := False
Endroutine
Mthroutine Named(LoadRP)
* do your loading of RP
Signal FinishedLoading
Endroutine
the Method StartLoadingRP makes the #LoadingImage VISIBLE when the routine ENDS.
the Signal will be processed as soon as possible (its the same as the technique described for javascript).
By using Signals, you give the browser time to show things.
you can also use a #PRIM_TIMR to set a delay before things happen:
Code: Select all
Define_com class(#PRIM_TIMR) Name(#RPTimer) Startup(Manual) Interval(5000)
Mthroutine Named(LoadRP)
* do your loading of RP
#RPTimer.Start
Endroutine
Evtroutine Handling(#RPTimer.Tick)
#RPTimer.Stop
#LoadingImage.Visible := False
Endroutine
B.