开发者

Javascript Interpreter for .NET

开发者_如何转开发

I've got a scenario where I need to run a Javascript interpreter in a .NET application. This is going to be running on Windows Phone 7, so it needs to be Compact Framework-compliant and because it probably won't be pre-packaged for Windows Phone source could help there.

Also the licensing can be an issue. We looked at using Jint which is under an MIT license, but it uses Antlr, which is under a BSD license (as I understand it Jint is in non-compliance for not redistributing the Antlr copyright and conditions). Any other alternatives out there?


It's been some effort, but I've actually been able to retrofit Jint to work on WP7. There was a bit of reflection that was easily rewritten (mostly to marshal calls from JS to .NET objects), and a couple bugs that needed to be patched, but in the end it seems to be working.

Hopefully I'll be able to submit these back to the Jint project once I have some spare time.


http://jurassic.codeplex.com

Although I don't know if it is Compact Framework compliant.


You can make JavaScript calls using the web browser control. It requires no additional libraries. You will need to do a little hacking around to make the control invisible, retrieving data etc, but it should do the trick.

Or you can try this project:

Javascript .NET integrates Google's V8 Javascript engine and exposes it to the CLI environment. Javascript .NET compiles (at runtime) and executes scripts directly from .NET code. It allows CLI objects to be exposed and manipulated directly from the executed Javascript.


Since this question was asked, Jurassic has been released. This is a .NET Javascript interpreter that works on the full CLR as well as the phone (or so they claim).

I haven't started to migrate to it yet, so I don't know if it works, but here it is for any of you that are interested.


As Bryan says, you can run your Javascript in the web browser control if you want to - I think this might be your only option if you do need to run JS.

There is also an effort underway to develop IronJS - https://github.com/fholm/IronJS - but I don't expect this to be ready for WP7 soon - nor do I expect it to be fully functional there.

If you could switch to a different scripting language - Ruby - then IronRuby is available on the phone (see the iron7 pics and videos for what can be done with it).


You should try: https://github.com/gatapia/js.net

I haven't tried on WP7 but may work?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜