This may prove useful to someone.
My ABMaterial webserver does on-the fly translation of text to whatever language the browser is using - its a bit more sophisticated than that in that it remembers any past translations for future use.
To achieve this I do something like:
The problem was I initially just put the multiple PassedPage.ws.Eval(script_str, Null) calls without wrapping them in PassedPage.Pause/Resume.
Which led to very unreliable flakey results - sometimes it worked other times it didn't.
I eventually found that if they are wrapped as shown all works beautifully.
My ABMaterial webserver does on-the fly translation of text to whatever language the browser is using - its a bit more sophisticated than that in that it remembers any past translations for future use.
To achieve this I do something like:
B4X:
Sub ABMComp_Refresh(PassedPage As ABMPage, PassedInstanceName As String)
...
'Create temporary script - telling user we are translating
script_str = _
$"
document.getElementById('divtranslating').style.display = 'block';
"$
PassedPage.Pause
PassedPage.ws.Eval(script_str, Null)
PassedPage.Resume
...
'Create raw script
script_str = _
$"
document.getElementById('divtranslating').style.display = 'none';
...
"$
...
'Translate raw script
script_str = translatefunction(script_str)
....
'Load translated script
PassedPage.Pause
PassedPage.ws.Eval(script_str, Null)
PassedPage.Resume
...
End Sub
Which led to very unreliable flakey results - sometimes it worked other times it didn't.
I eventually found that if they are wrapped as shown all works beautifully.