Forum Cross Platform with Xamarin

JavaScript engine instead WebView

Hi everyone!
I need cross javascript engine instead WebView.
I found
http://javascriptdotnet.codeplex.com

http://jint.codeplex.com/

and I try http://jint.codeplex.com/ on xamarin.Android :

 using System;
 using Jint;
 namespace Krista.FM.Android
 {
public static class JSengine
{
    public static void StartJS()
    {
        string script= @"
        function square(x) { 
             return x * x; 
        };
        return square(number);
                    ";

        var engine = new JintEngine();
        engine.SetParameter ("number", 3);
        //int k = (int)
        engine.Run (script);
    }
}
 }

but get error

[mono-rt] Stacktrace:
[mono-rt]
[mono-rt] at <0xffffffff>
[mono-rt] at Jint.JintEngine.Run (Jint.Expressions.Program,bool)
[mono-rt] at Jint.JintEngine.Run (string,bool)
[mono-rt] at Jint.JintEngine.Run (string)
[mono-rt] at Krista.FM. .Android.JSengine.StartJS () [0x0001a] in d:\repository\RepoMobileFM\ \Projects\Android\Krista.FM. .Android\Utils\JSengine.cs:21
[mono-rt] at Krista.FM. .Android.DetailVCActivity2.OnCreate (Android.OS.Bundle) [0x001b5] in d:\repository\RepoMobileFM\ \Projects\Android\Krista.FM. .Android\ViewControllers\DetailVCActivity\DetailVCActivity2.cs:116
[mono-rt] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00010] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.8.0-branch/3f1c339b/source/monodroid/src/Mono.Android/platforms/android-14/src/generated/Android.App.Activity.cs:1945
[mono-rt] at (wrapper dynamic-method) object.9ab135c6-e30b-4baa-a929-0950391a8b46 (intptr,intptr,intptr)
[mono-rt] at (wrapper native-to-managed) object.9ab135c6-e30b-4baa-a929-0950391a8b46 (intptr,intptr,intptr)
[mono-rt]
[mono-rt] =================================================================
[mono-rt] Got a SIGSEGV while executing native code. This usually indicates
[mono-rt] a fatal error in the mono runtime or one of the native libraries
[mono-rt] used by your application.
[mono-rt] =================================================================
[mono-rt]

Sign In or Register to comment.