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
1
vote
0 answers

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() { var engine = new Jint.Engine(c => c.AllowClr()) …
nee
  • 111
  • 4
1
vote
2 answers

assigning a function to a name globally

I need a javascript function f that given another (anonymous) function g and a name n will assign g to that name in the global scope (or at least the current scope). I should be able to use it like this: f(function(){ /* code */ }, "foo"); foo();…
Torbjørn
  • 6,423
  • 5
  • 29
  • 42
1
vote
0 answers

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 properties on returned objects works fine, but…
1
vote
1 answer

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 .script file can contain javascript that is parsed by…
Vencarii
  • 45
  • 6
1
vote
0 answers

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

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.Native.JsValue class. Since it has no…
Larry Tang
  • 642
  • 5
  • 23
1
vote
0 answers

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 time. Would it be possible to: quickly clone the…
Karol Kolenda
  • 1,660
  • 2
  • 25
  • 37
1
vote
0 answers

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 CLR objects Object -> expando objects (…
tonyjy
  • 1,359
  • 3
  • 12
  • 24
1
vote
1 answer

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]);").GetCompletionValue(); Which, when…
user2950509
  • 1,018
  • 2
  • 14
  • 37
1
vote
1 answer

using jint to call javascript using d3 from c#

I am currently working on a project where we need to generate some SVG based on some input data. Currently all this SVG generation is implemented in javascript using the d3 library. Note that my goal is to be able to reuse this logic and not…
1
vote
1 answer

C# Jint Set value to javascript variable

Need to assign value to javascript variabile in this example in need to return value. 1° First i register a simple function Engine js = new Engine(); js.SetValue("get_s_width",new Action(get_s_width)); public void get_s_width(int i) …
Joe Martiniello
  • 323
  • 1
  • 3
  • 13
1
vote
3 answers

How do I parse javascript code in Jint interpreter?

I want to make sure javascript code is valid syntax: string test = " var i = 0; "; Jint.Engine ScrptingEngine = new Jint.Engine(); bool result = ScrptingEngine.Parse(test);
Bill Software Engineer
  • 7,362
  • 23
  • 91
  • 174
1
vote
0 answers

Using a Promises\A+ polyfill library in Jint, what alternatives to setTimeout do I have?

I am using an es6 Promises polyfill library (es6-promise) hosted in a Jint engine and for the most part, it is working well. In order to have it work, I have needed to provide a setTimeout implementation and I took my inspiration from…
westyside
  • 116
  • 5
1
vote
1 answer

Invoking javascript file with dom access

I have a javascript file that has code with DOM access var a=document.getElementById("abc").value I have html file, that contains all DOM information ... Is there anyway to get C# invoke the javascript file, and…
william007
  • 17,375
  • 25
  • 118
  • 194
1
vote
1 answer

How to obtain a proper C# string array from a JavaScript function call using Jint

I'm using Jint to evaluate JavaScript within a C# application. My JS returns an array of strings: return ["blah", "blah", "blah"]; But I'm not sure how to properly use that array once I'm back in C#: Object result = e.Execute…
Chris Williams
  • 11,647
  • 15
  • 60
  • 97