How to access Javascript module with Duktape in Android

I am successfully parsing and evaluating a javascript file with Duktape in my Android application using Kotlin.

val file_name = "lib.js"

val js_string = application.assets.open(file_name).bufferedReader().use {
  it.readText()
}


val duktape = Duktape.create()

try {
  Log.d("Greeting", duktape.evaluate("'hello world'.toUpperCase();").toString())
  duktape.evaluate(js_string)

} finally {
  duktape.close()
}

The javascript file was created with Browserify, so it is one single file with everything and it is working fine. But I need to request a module and a method from the module, example:

var test = require('testjs-lib');
test.EVPair.makeRandom().toWTF();

I have no idea of how to do it and have not found any example, besides this link: http://wiki.duktape.org/HowtoModules.html

It tells me to use a modsearch, but I don't have a clue how to do it or where it should be placed, not even if it is applicable for the Duktape Android (https://github.com/square/duktape-android).

Has anybody done it successfully that could shed some light on this matter?

Answer:1

I'm using this class as my key to Hashmap with overriden hasCode() and equals() public class Design { private double[] factors = null; public double[] getFactors() { return factors; } public ...

I didn't understand why I am getting empty list from criteria, and I have data in my table. code where I'm getting List: hibernateSession_destination = HibernateUtilReports.INSTANCE.getSession(); ...

I've recently began using EHCache for caching purposes. I know, how to use it in Java code, but I'm still not sure about the configuration file. So, I have an ear project, that includes several war ...

I have two questions(problems actually) while parsing the html page using HtmlUnit.I tried their 'Getting Started` as well as searched google but no help.Here is my first problem. 1) I want to ...