getRhinoContext

suspend fun getRhinoContext(): Context

Get rhino context in a safe way as it needs to be initialized on the main thread. Make sure you get the scope using: val scope: Scriptable = rhino.initSafeStandardObjects() Use like the following: rhino.evaluateString(scope, js, "JavaScript", 1, null)