16

This is more out of curiosity that a real requirement, but I'm wondering if it's possible to treat JavaScript as (ideally) a first-class .NET citizen, or (secondarily) have some way of invoking/interpreting pure JavaScript functions (that don't require the DOM) in a desktop setting?

Has anyone ever attempted implementing a CLR version of JavaScript? Something tugs at the back of my mind concerning this, but now that I think about it it was probably PHP, not JavaScript.

devios1
  • 36,899
  • 45
  • 162
  • 260

6 Answers6

6

For your second option, there's Rhino and things like it.

MarkusQ
  • 21,814
  • 3
  • 56
  • 68
4

Using the DLR (Dynamic Language Runtime) you can use Managed JScript. See the official JScript blog from Microsoft here.

http://blogs.msdn.com/jscript/archive/2007/05/04/managed-jscript-announced.aspx

This is goes for Ruby (IronRuby), Python (IronPython), and Dynamic VB. You can also write your own DLR language.

Danny G
  • 3,660
  • 4
  • 38
  • 50
2

JScript is available on .NET as a first-class citizen. It's not exactly JavaScript, but it may be close enough for your needs.

Matthew Olenik
  • 3,577
  • 1
  • 28
  • 31
1

According to this page, there used to be 2 "implementations" on the CLR:

http://blogs.ugidotnet.org/nettools/articles/8060.aspx

But both seem to be dead...

Ward Werbrouck
  • 1,442
  • 18
  • 32
1

It's perfectly possible to run JavaScript applications without the use of a web browser. You can do this just by running the application using cscript (typically javascript files end with .js).

Pete OHanlon
  • 9,086
  • 2
  • 29
  • 28
  • Oh hey Pete! Didn't notice that was you. :) Unfortunately I'm looking for a solution that I can embed into an application, but that's interesting and I didn't know you could do that! – devios1 Mar 18 '09 at 03:25
  • Going well--I've given up on WPF and am switching to the web side of things a la ASP.NET MVC, AJAX and such nifty acronyms. ;) Luckily my work is not bound to any particular OS (though my knowledge is still mostly .NET). – devios1 Mar 19 '09 at 20:23
0

You can also run .js files with node.js. Hope this helps someone else.

javamonkey79
  • 17,443
  • 36
  • 114
  • 172