Search code examples
javascriptwindows-phone-7windows-phone-8windows-8win-universal-app

JavaScript Engine in Universal Windows App (C#,XAML)


I am developing an Universal Windows App using c# and XAML. And the requirement is in the App I need to pass a value to a Javascript code to get a result.

Is there any JavaScript engine for Universal Windows App similar to JavaScriptCore in IOS. If so please advice me.


Solution

  • You can use Jint (https://github.com/sebastienros/jint). I just tested and confirmed that it works in XAML Universal Apps. Just add the NuGet package and follow the docs.

    From the official docs:

        var engine = new Engine()
            .SetValue("log", new Action<object>(Console.WriteLine));
    
        engine.Execute(@"
          function hello() { 
            log('Hello World');
          };
    
          hello();
        ");