6

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?

6 Answers 6

5

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Do you have any information on this - I'm starting to try the same approach and if there's any shortcut available it would be very helpful - me[at]slodge[dot]com
Just for my own record, here's a fork which also is also based on jint which claims to make it compatible to the .NET 3.5 compatible framework: github.com/flts/jint
4

http://jurassic.codeplex.com

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

3 Comments

Well, it runs on Silverlight, so you might be able to adapt it to work on WP7.
It compiles the code on the fly. The whole Reflection Emit namespace is unavailable on WP7
This has since moved to github.com/paulbartrum/jurassic .
2

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.

2 Comments

Javascript.Net is no good for WP7 - it's a C++ interop library and it also need V8 (Chrome) installed to make it work.
I should have clarified, I'm actually looking for something I can run under Silverlight and XNA, which rules the WebBrowser control out.
1

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.

Comments

0

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).

Comments

0

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

I haven't tried on WP7 but may work?

2 Comments

From the comments: "A wrapper around V8: Include js.net.dll in your project and you can run JavaScript straight from your .Net programs." It uses a native DLL with PInvoke wrapped around it.
@Hounshell: The V8 wrapper is just the default engine implementation. You can also use IronJS which is pure managed code. IronJS is F# however so not sure if WP7 discriminates about IL generated by F# compiler.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.