Questions tagged [jint]

Jint is a JavaScript interpreter for .NET.

Jint is a script engine based on the JavaScript language. Using Jint, developers can provide fully scriptable applications, execute .NET code without compiling, or create external configuration logic, using the most used script language.

Jint aims at providing every JavaScript functionalities to .NET applications, and bindings to .NET languages can be done in both sides. Jint scripts can use any .NET object from your application, and use every part of the .NET base class library.

Jint has been rewritten completely and is now hosted on Github.

Jint Information (codeplex archive)

118 questions
0
votes
1 answer

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.myProperty = null; } } const o = new MyClass; return…
lycandroid
  • 181
  • 10
0
votes
1 answer

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 working fine. But when I am trying to add…
Anshul
  • 55
  • 2
  • 9
0
votes
1 answer

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 => x.AllowClr()); object rc = _engine .SetValue("foo", new…
Ron Idaho
  • 57
  • 4
0
votes
0 answers

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.AddDays(-90)){true}", "ErrorKey":…
0
votes
0 answers

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 of tokens and then removing the names of any…
Dan
  • 901
  • 11
  • 25
0
votes
1 answer

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 entirely new console engine for each JavaScript…
Larry Tang
  • 642
  • 5
  • 23
0
votes
2 answers

Convert std:set into jintArray

I'm provided a std::set 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: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR),…
Darthg8r
  • 12,377
  • 15
  • 63
  • 100
0
votes
0 answers

JINT convert Dictionary 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 Unity as a simple string): var a =…
0
votes
0 answers

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 contains the long running piece of code so simple…
Tristan Trainer
  • 2,770
  • 2
  • 17
  • 33
0
votes
0 answers

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 = File.ReadAllText("file.js"); for (int i = 0; i <…
Tristan Trainer
  • 2,770
  • 2
  • 17
  • 33
0
votes
1 answer

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 the result to be the same - whether it's in .NET…
0
votes
1 answer

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 get an exception "unexpected reserver word in line…
Aravor
  • 197
  • 1
  • 1
  • 6
0
votes
1 answer

execute exe file using Jint - Javascript Interpreter

i have a created one console application and in that i had use Jint - JavaScript Interpreter to run javascript function . but when i use activexobject in javascript it give me a error the code is: string script= @" function…
Suresh Chaudhary
  • 1,609
  • 5
  • 25
  • 40
0
votes
1 answer

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",]},{"$JOB_NO":["Job…
mister_b
  • 207
  • 3
  • 11
0
votes
1 answer

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 not available in Jint, but, underscore.js is…
Andrew
  • 285
  • 1
  • 2
  • 11