Questions tagged [jint]
Jint is a JavaScript interpreter for .NET.
109
questions
0
votes
0
answers
11
views
Read let and const values from Engine
Hi I'm making an interactive environment to write js, and want people to be able to see the data they created in the engine after executing statements.
Consider this js:
a=1
var b=2
const c = 3
let d ...
0
votes
1
answer
81
views
Pass js object to C# function
I'm trying out Jint and want to implement the fetch api to use from js. The second argument is a nested js object that is passed in:
fetch('https://example.com', {
method: 'post',
headers : {
...
0
votes
0
answers
19
views
Execute vs. Invoke for resolving a Promise in Jint
I'm new to Jint and have noticed that calling Invoke on JS code with a Promise does not resolve as expected but calling Execute does. So given this code:
const string jscode = @"
...
4
votes
3
answers
112
views
How do I return a value from a C# function using jint?
I'm currently using Jint (https://github.com/sebastienros/jint) to process JavaScript.
I would like to be able to use a custom function in JavaScript that will execute a function created in C# and ...
0
votes
1
answer
74
views
Implementing require in the absence of node
Modules generally start something like this
(function(root, factory)
{
/* globals define */
if (typeof define === 'function' && define.amd)
{
// AMD. Register as an ...
0
votes
1
answer
77
views
Editing .js with Jint
I am trying to edit the below javascript with jint. I really only want to edit var antiCapthaPredefinedApiKey = ''; and set the proxy settings in defaultConfig while at runtime. I have a winforms, I ...
0
votes
1
answer
194
views
Jint. How to set property of class, or invoke method, of class?
With Jint how can I set a property (or invoke a method) of an instance of a javascript class?
e.g. if I do:
var o = new Jint.Engine().Evaluate(@"
class MyClass {
constructor() {
this....
1
vote
0
answers
107
views
XMLHttpRequest (XHR) for Jint
I am working on a program (C# with .Net Core 3.1) that needs to be extended with javascript. These javascripts need to be able to send web requests.
Since I like the implementation of Jint (https://...
1
vote
0
answers
69
views
What is the range of classes included in AllowClr()?
I have set "AllowClr()" to access classes in a .NET assembly, but I cannot access some classes.
What is the range of classes included in "AllowClr()" ?
static void TestA()
{
...
3
votes
1
answer
928
views
Pass an object to a function in jint and return a value
I'm attempting to pass an object to a javascript function via jint and return a value. But it doesn't seem to work. Here is what I have tried so far -
Error -
Jint.Runtime.JavaScriptException: 'obj is ...
2
votes
0
answers
639
views
JINT performance is significantly worse when an application is run as a 64bit application
The application requires JS support (the program is written in C#) and JINT is being used as the interpreter. I have noticed how performance significantly degrades when the application is run as a ...
0
votes
1
answer
254
views
Parsing and evaluating complex objects using JInt
I have a requirement to evaluate certain expressions, and based on the evaluation choose the next steps.
I am trying to use JInt javscript interpreter for this.
For basic evaluations from json, it is ...
1
vote
0
answers
161
views
Accessing JSON array items from Javascript returned from C# using Jint
I am trying to communicate back and forth between C# and Javascript, using Jint. Mostly smooth sailing, however I am unable to access items in arrays returned from C# within my JS scripts. Accessing ...
0
votes
1
answer
166
views
Jint: using CLR object 's properties in Javascript functions
I have been testing the jint library and hit a snag. Given this class in C#:
public class Foo
{
public string Name { get; } = "Bar";
}
And this code:
Engine engine = new Engine(x => ...
3
votes
2
answers
371
views
C# non-static class inside static class JINT
Hi trying to make a class inside a static class to use in JINT but when it's referenced I get an error
C# code
namespace Hi {
public static class Ok {
public class Wowa {
...
-1
votes
1
answer
58
views
GetCompletionValue with IIFE trigger errors
I get a exception if I try to use GetCompletionValue with Invoker.
How can i execute the run function with IIFE lexical scope?
Javascript:
(function(){
function run() {
logger('teste logger');
...
1
vote
1
answer
279
views
Jint (.NET javascript parser) always returns ExpandoObject
I try to write a mod for a game. This is totally new territory for me, so I might be on the wrong track here.
The game is written in Unity and you are able to add a .script file to your mod. The ....
0
votes
0
answers
137
views
How to evaluate datetime expression in JSON File?
I have Json File like below:
{
"Country": "QAT",
"Rules": "if(BO.SenderCountryId == 'QAT' && BO.SenderIdExpiryDate < DateTime.Today....
0
votes
0
answers
121
views
Jint.Parser.JavaScriptParser: Distinguishing top-level identifiers
I am trying to detect all global variables referenced by a JavaScript code snippet using Jint.Parser.JavaScriptParser. I'm doing this by following the code example from this issue to retrieve a list ...
0
votes
0
answers
210
views
C# - Jint Generic Methods
I am new to using Jint (the Javascript Interpreter for .NET) and am trying to gain a better understanding of the complete functionality. Looking at the documentation, I see support of Generic types ...
1
vote
0
answers
112
views
Using moment.js with jint
I would like to use moment.js with jint. I have tried several alternatives, but always end up with this error:
Self referencing loop detected for property 'Engine' with type 'Jint.Engine'. Path '...
1
vote
0
answers
450
views
Serialize "JsValue" in Jint
At the moment, I'm trying to figure out how to save a Jint.NET JavaScript environment to file, so I can load it again later.
However, I'm having major trouble trying to serialize/deserialize the Jint....
0
votes
1
answer
285
views
Is there a way to switch environments while using Jint.NET?
I'm currently using the Jint.NET JavaScript console engine for C#, and I'm attempting to emulate separate JavaScript environments that the user can switch between.
However, I don't want to create an ...
0
votes
2
answers
212
views
Convert std:set<int> into jintArray
I'm provided a std::set<int> object that I need to convert/copy into a jintArray to return to an Android app. I tried the code below, but it seems to be crashing my app with only this as a clue:...
2
votes
1
answer
120
views
Attach VSCode Debugger for Typescript/Javascript Debugging to a C# Winforms Application
In my C# WinForms application I execute javascript with jint. The javascript code is the result code of my transpiled typescript file. I use inline source mapping.
Now I want to give the users of my ...
6
votes
0
answers
229
views
IActiveScriptParse32::ParseScriptText Memory Leak
Has anybody ever faced a memory leak problem with IActiveScriptParse32::ParseScriptText when using it in C#?
I need a ScriptEngine that is able to parse JavaScript-Code. (Everything works fine, except ...
2
votes
0
answers
246
views
Using a delegate to handle a Javascript callback in JINT
In the following code using JINT, the call to the Setup1 method works and the call to Setup2 method does not. The call to Setup2 raises the error: Jint.Runtime.JavaScriptException: 'No public methods ...
0
votes
0
answers
424
views
JINT convert Dictionary<String, Object> to JSON string
I'm using PowerUI and Unity (+Jint built in to powerUI) to attempt to read JSON data coming in from the JavaScript code side, on the C# side. For example, I have some JavaScript code (coming into ...
0
votes
0
answers
87
views
Is there a way to select a task that is not currently running from a list of tasks?
I have some code currently that is calling a method on an object in excess of 1,000,000 times. This code section currently takes about 2minutes to run. This method also has a lock within it that ...
0
votes
0
answers
114
views
Is there a way in Jint to store a function to a Func?
I am using Jint to dynamically run functions for my C# code. It works perfectly for running the functions. However the execution time is linear per execution
var engine = new Jint.Engine();
var rule =...
-1
votes
1
answer
82
views
Add multiple formula arguments
I have a Javascript formula saved in Database as a string and want to calculate it using JINT in C#.
The formula has multiple variables and need to set them with their values.
int height = 10
int ...
0
votes
1
answer
303
views
How do I print complete element arrays in Jint - like you can with Javascript?
I'm trying to access a Javascript array through Jint. We're basically accepting custom javascript code in an application that works across a variety of platforms and are using Jint for .NET. We need ...
0
votes
1
answer
261
views
Jint "unexpected reserved word"
I am using the Jint interpreter for C# Jint
I want to run the following JavaScript code.
class User {
constructor(name) { this.name = name; }
sayHi() { alert(this.name); }
}
...
But I always ...
1
vote
0
answers
156
views
Is it possible to clone or save/restore engine state in Jint?
I've got relatively long initial code and then I use the engine to execute a single statement which can affect engine state. I would like to speed things up by not re-executing initial code all the ...
0
votes
1
answer
906
views
Reading JSON objects from javascript file using JINT
I've been supplied with a javascript file containing two JSON objects such as this.
var languages = {"Languages":["English","Cymraeg","Deutsch"]};
var labels = [{"$JOB":["Job","Orchwyl","Auftrag",]},{...
3
votes
0
answers
166
views
How do I serialize/deserialize Jint engine into string/file
Would it be possible to serialize Jint JS engine into a string or a file, and deserialize and load it at a later point? if this is not possible with Jint, is it possible with any other .NET JavaScript ...
0
votes
1
answer
313
views
How can I use underscore functions in Jint
I'm using Jint for executing javascript in my c# project and I need to access functions like map, filter, reduce etc on an Array.
From what I've been able to find here, the native array functions are ...
4
votes
1
answer
1k
views
JInt require another js file
I am looking a way to include another js file natively in JInt (javascript interpreter for C# Unity). I understand that I can simple concatenate all my js files to one string and run it via normal way....
0
votes
1
answer
1k
views
JINT-How to catch exception in CatchClrExceptions in JINT?
I want to catch the clr exceptions thrown from javascript. Below things i have tried.
var registerScript = new Engine(c => c.AllowClr(typeof(Manager).Assembly ).CatchClrExceptions(ExceptionHandler(...
2
votes
1
answer
551
views
Getting "document is not defined" error when checking for valid jQuery code though JInt?
Is it possible to check if a JQuery string has a valid syntax? I've tried Jint because of this Determine whether a string contains valid javascript code. Unfortunately, it seems as if this is meant ...
0
votes
1
answer
704
views
Reading a value from a List<Employee> in Jint
A general question first: Is there somewhere a documentation about jint? I was not able to find anything apart from the examples on the github page.
I'm trying to do something like the sample below ...
4
votes
3
answers
2k
views
How to Enumerate a Dictionary<> in Jint
I have a .NET Generic Dictionary<> that I want to pass to a JavaScript function which I am running in Jint.
Jint doesn't treat the .NET Dictionary like a JavaScript object which can be treated ...
0
votes
1
answer
762
views
How to find my javascript function in Jint in C#?
I wrote code below
static void Main(string[] args)
{
var engine = new Engine();
var file = File.ReadAllText(@"...\Desktop\beautify.js");
var final = file + Environment....
0
votes
1
answer
1k
views
Call a function in a parsed Jint program
I use Jint to parse JS code and call functions in it. As I use a multithreaded environment, I use the program-parsing approach as indicated in the response to this issue: https://github.com/...
1
vote
0
answers
283
views
Does JINT support 128-bit floating point, like C# System.Decimal? If so, how?
Jint is a Javascript interpreter for .NET. It will convert JavaScript values to CLR objects like below. https://github.com/sebastienros/jint/blob/master/README.md
JINT converts JavaScript values to ...
0
votes
1
answer
880
views
Eval javascript object using jint
I'm using jint to parse javascript code, the following js codes work:
1
[1]
{}
but this one fails:
{ a: 1}
with this error:
int.Parser.ParserException: Line 1: Unexpected token :
at Jint....
2
votes
1
answer
1k
views
Jint Array functions ECMA 5.1
I'm attempting to use Jint (v2.10.4.0) to translate one arbitrary JSON structure to another. However, I am having issues with using map.
According to the ECMA 5.1 language spec, map should exist on ...
0
votes
1
answer
151
views
How do I tell if my Javascript code is running in Jint?
I've designed some functions which call alert() and confirm().
I use Jint to test those functions.
However, Jint doesn't support alert() and confirm().
What I'd like to do is create a wrapper ...
1
vote
1
answer
570
views
Jint+JSfuck - 'Index was outside the bounds of the array'
I'm trying to run the following code in jint:
Jint.Engine engine = new Jint.Engine();
var result = engine.SetValue("data", data).Execute("(/\\n(.+)/.exec(eval(data.replace(/\\s+/, \"\").slice(0, -2)))...
-1
votes
1
answer
1k
views
Using jint to decode Jsfuck
I'm trying to use jint to decode jsfuck, and am basing myself off this project: https://github.com/enkhee-Osiris/Decoder-JSFuck (it's the only one I've found that can decode the jsfuck correctly). The ...