96 questions
1 vote
0 answers
79 views
failed to load native module ("Ultralight.dll") via require() in Duktape
I have a 3rd party program that allows scripting via JavaScript (JS) using the Duktape JS engine. I am attempting to load the Ultralight DLL module through Duktape in order to call certain functions ...
1 vote
0 answers
138 views
How can Babel transpile a Node.js module polyfill (e.g. buffer) to ES5?
I would like to transpile JS code which uses the Node 'buffer' to pure ES5 so it can run on Duktape (with Webpack and Babel). The code has been simplified in a test.js, which uses buffer and console: ...
0 votes
0 answers
89 views
Azure login using Javascript in zabbix server. its using duktape javascript implementation
i need to login to Azure from Zabbix server that is located in Azure i enabled identity on the server now i need to login to azure using the identity within a javascript item i saw that in need to ...
1 vote
0 answers
107 views
Define JavaScript static method in C using Duktape
I would like to define a static method on a class. I have the same version using new working fine, I want a static method, thought. I have tried this: duk_push_c_function(ctx, call, DUK_VARARGS); ...
1 vote
0 answers
68 views
Duktape Copying Objects
I've got a duktape stack with the item on the top of the stack being effectively a JSON object, built with duk_push_string() / duk_put_prop_string(). My resulting object in javascript land is called '...
-1 votes
1 answer
201 views
lambdas with duktape (using C++) [duplicate]
I want to call duk_push_c_function() with a lambda defined in C++, a bit like this: SomeObjType parameter; // store stuff in 'parameter' auto myLambda = [parameter](duk_context* ctx) { // do stuff ...
0 votes
1 answer
115 views
Timeout stopped working for me with Duktape v2.7.0
I had timeouts working nicely with Duktape v2.5.0. In my duktape.h file, I appended: #define DUK_USE_EXEC_TIMEOUT_CHECK JSduk_timeout_check // our timeout check function duk_bool_t JSduk_timeout_check(...
0 votes
2 answers
333 views
Why is my Kotlin/JS program failing with "RangeError: Maximum call stack size exceeded"?
I’ve written a Kotlin/JS program that is crashing on some JavaScript engines. It’s crashing on GraalVM like this: RangeError: Maximum call stack size exceeded at <js> 839(myprogram.js:394:...
0 votes
2 answers
384 views
duktape js - have multiple contexts with own global and reference to one common 'singleton'
We are in the process of embedding JS in our application, and we will use a few dozen scripts each assigned to an event. Inside these scripts we provide a minimal callback api, function onevent(value) ...
1 vote
1 answer
130 views
How can I do some clean up jobs when an object is being deleted / disposed in duktape?
I have a self-defined class that calls a native method to allocate buffer in the constructor method, like below: MyClass = function () { this.buffer = native.alloc() } The buffer has to be ...
0 votes
4 answers
263 views
How can I get an error object after an ECMAscript throw( )?
I can throw errors in C++ code by pushing an error object and then calling duk_throw(). duk_pcall() returns with 'outcome != DUK_EXEC_SUCCESS' and I can examine the error object to determine, for ...
0 votes
1 answer
271 views
How to run a whole js files multiple times using duk_pcall?
I want to use duk_pcall to do it, here is what I tried: Firstly, I load the script file into a char* string. Secondly, use duk_pcompile_string(ctx, 0, programBody) to compile it. Then, I can use ...
0 votes
1 answer
174 views
Catching and recovering from error in C++ function called from Duktape
I have created a plugin for the OpenCPN marine navigation program that incorporates Duktape to provide a scripting capability. OpenCPN uses wxWidgets. Basically, the plugin presents the user with a ...
0 votes
0 answers
83 views
Android Duktape NullPointerException while Internet is not there
I am getting a null Exception when there is no internet on my mobile. it is showing error here: val results: String? = jsBinder.androidWrapper(functionName, gson.toJson(input)) input is Any type ...
0 votes
1 answer
241 views
Duktape - error with for of loop when evaluating
With the following code duktape gives me a parse error for the for of loop. string script = u8R"(var foo = [ "foo", "bar" ] for (var ...