Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use remote JS #1

Open
AnthoDingo opened this issue Jul 4, 2024 · 0 comments
Open

Use remote JS #1

AnthoDingo opened this issue Jul 4, 2024 · 0 comments

Comments

@AnthoDingo
Copy link
Collaborator

using Jint;
...
var engine = new Engine()
    .SetValue("log", new Action<object>(Console.WriteLine))
    .Execute("function hello() { return 'Hello, world!'; }");

var result = engine.Invoke("hello");
Console.WriteLine(result); // Affiche "Hello, world!"

or

using Jint;
using System.IO;
...
var engine = new Engine()
    .SetValue("log", new Action<object>(Console.WriteLine));

string jsCode = File.ReadAllText("chemin_vers_votre_fichier.js");
engine.Execute(jsCode);

var result = engine.Invoke("nom_de_la_fonction");
Console.WriteLine(result); // Affiche le résultat de la fonction JavaScript

Implement Stream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant