嵌入JavaScript引擎到.NET [英] Embedding JavaScript engine into .NET

查看:113
本文介绍了嵌入JavaScript引擎到.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想知道是否有人曾经试图嵌入和集成实际上任何JS引擎到.NET环境。我能找到和实际使用(艰辛和努力的后,因为它是pretty已过时,不完全结束)SpiderMonkey的-DOTNET项目。任何人只要有这方面的经验?像发动机的SquirrelFish,V8 ..

just wondering if anyone has ever tried embedding and actually integrating any js engine into the .net environment. I could find and actually use (after a LOT of pain and effort, since it's pretty outdated and not quite finished) spidermonkey-dotnet project. Anyone with experience in this area? Engines like SquirrelFish, V8..

这并不是说我不满意Mozilla的SpiderMonkey的(使用它的Rails样miniframework的核心ASP.NET应用程序中的自定义组件),但我仍然希望进一步探讨了一下用的选项。命令行的解决方案是不是我需要什么,我不能靠任何东西比CLR,我需要从/成JavaScript / C#对象调用的方法。

Not that I'm not satisfied with Mozilla's Spidermonkey (using it for Rails-like miniframework for custom components inside the core ASP.NET application), but I'd still love to explore a bit further with the options. The command-line solutions are not what I'd need, I cannot rely on anything else than CLR, I need to call methods from/to JavaScript/C# objects.

// c# class
public class A
{
    public string Hello(string msg)
    {
        return msg + " whatewer";
    }
}

// js snippet
var a = new A();
console.log(a.Hello('Call me')); // i have a console.log implemented, don't worry, it's not a client-side code :)

只是为了澄清 - 我并不想真正程序的应用程序本身在服务器端JavaScript。它仅用于编写自定义用户子应用(可以被看作是某种DSL的)。它更容易(更安全),使正常的人在JS编程比C#。

Just to clarify - I'm not trying to actually program the application itself in server-side javascript. It's used solely for writing custom user subapplications (can be seen as some sort of DSL). It's much easier (and safer) to allow normal people programming in js than C#.

推荐答案

尝试的Javascript .NET 。它托管在GitHub上它最初托管于codePLEX,这里

Try Javascript .NET. It is hosted on GitHub It was originally hosted on CodePlex, here)

项目的讨论:<一href=\"http://javascriptdotnet.$c$cplex.com/discussions\">http://javascriptdotnet.$c$cplex.com/discussions

它实现了谷歌的V8。您可以编译并直接从.NET code与它运行JavaScript,和供应CLI反对由JavaScript code使用为好。它从JavaScript生成本地code。

It implements Google V8. You can compile and run JavaScript directly from .NET code with it, and supply CLI objects to be used by the JavaScript code as well. It generates native code from JavaScript.

这篇关于嵌入JavaScript引擎到.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆