Does Windows 8 Compile JavaScript?

2019-04-28 10:10发布

问题:

It is exciting that Windows 8 is supporting so many languages for Metro App development. One that especially interested me was the HTML5/CSS/JavaScript. What I don't understand, is this code going to get compiled in a sort of executable (like the C#, VB, and C++ option), or would my app basically be running in IE as an actual web page?

回答1:

Yes. Javascript is executed on Windows 8 by the Chakra engine. Similar to the .NET just-in-time compiler, it translates javascript to optimized machine code. Also the approach taken by Google's V8 and Mozilla's TraceMonkey engines. Some background info is here.



回答2:

Here's a video overview of some of how to use JavaScript with the new Windows 8 Runtime from BUILD2011 (slides also available on the same page). The presenter goes through a simple project with JavaScript and the WinRT and gives a pretty nice overview of WinRT in general. You can read more about all that on this related SO thread.