Skip to content

Use remote JS #1

@AnthoDingo

Description

@AnthoDingo
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions