LiquidPlayer / LiquidCore

Node.js virtual machine for Android and iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to get process.versions on Context

bangonkali opened this issue · comments

When i try to get the versions on runtime in android i can't seem to get the version.

            context.evaluateScript("var versions = process.versions");
            val versions = context.property("versions");

            Snackbar.make(view, "Answer: ${versions.toString()}", Snackbar.LENGTH_LONG)
                .setAction("Action", null).show()

Error

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: se.netzon.blocks, PID: 8819
    ReferenceError: process is not defined
        at org.liquidplayer.javascript.JSContext.evaluateScript(JSContext.java:272)
        at org.liquidplayer.javascript.JSContext.evaluateScript(JSContext.java:284)
        at se.netzon.blocks.ItemListActivity$onCreate$1.onClick(ItemListActivity.kt:51)
        at android.view.View.performClick(View.java:7125)
        at android.view.View.performClickInternal(View.java:7102)
        at android.view.View.access$3500(View.java:801)
        at android.view.View$PerformClick.run(View.java:27336)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

References:
https://github.com/LiquidPlayer/LiquidCore/wiki/LiquidCore-as-a-Native-Javascript-Engine
#85

process is part of node.js -- it is not part of raw JavaScript. To use it, you cannot use LiquidCore just as a native javascript engine. You will have to use a MicroService, which loads the node.js runtime.

Thanks for the response @ericwlange !