breautek commented on issue #303:
URL: https://github.com/apache/cordova/issues/303#issuecomment-1368484057

   I'm not certain how feasible this is due to the architecture of Cordova but 
Android has an experimental 
[JavaScriptEngine](https://developer.android.com/jetpack/androidx/releases/javascriptengine)
 package, which allows you to build a javascript environment without a webview.
   
   In theory this could be used for background processing as it can be done in 
a service/WorkManager task.
   
   There are a few limitations of this however, one is that the 
[JavaScriptSandbox](https://developer.android.com/reference/kotlin/androidx/javascriptengine/JavaScriptSandbox)
 may be only supported on API 26 or newer devices, and only if the installed 
android webview has support for it.
   
   > Note: Applications must check JavaScriptSandbox availability by calling 
[JavaScriptSandbox.isSupported()](https://developer.android.com/reference/kotlin/androidx/javascriptengine/JavaScriptSandbox#isSupported())
 API. Make sure that the application verifies that the sandbox is supported on 
the device before calling any other JavaScriptSandbox methods. The sandbox is 
supported on API 26 and above if the WebView implementation supports it.
   
   JavaScriptEngine is not production ready so it's not something Cordova can 
use right now, and even if it was, we would need to bump our min SDK to at 
least API 26. So it's not something I can see being implemented in the 
foreseeable future, but it would be an interesting experiment, which 
potentially be a cordova plugin.
   
   iOS also has a similar system called 
[JavaScriptCore](https://developer.apple.com/documentation/javascriptcore?language=objc)
 which is available as of iOS 16.0, so similar story to Android... in order to 
use this feature, it will need to bump our min version to iOS 16 which is too 
restrictive at this time. But likely implementable in the form of a plugin as 
an experiment.
   
   > I'm not certain how feasible this is due to the architecture of Cordova
   
   Coming back to this, the main concern I have is Cordova makes a lot of 
assumptions and I don't think plugins will necessary have a guaranteed 
opportunity to control the webview instance just after the webview instance is 
created, short of implementing your own webview plugin. And if the JS is 
running in a background/service thread, it may not have safe access to the 
webview instance either.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to