English 中文(简体)
Embedding Javascript in My Application
原标题:

I want to embed Javascript in my own application. I know I can do this with all the open source Javascript engines like V8, TraceMonkey/SpiderMonkey. But, scanning through the source code learning how to embed them is not easy given most are not well documented. Is there anything native in Windows? Is the JScript engine already been exposed to user (perhaps through COM)? Would the JScript engine in IE9 (the one with compilation capability) be available for embedding by desktop appli?

问题回答

For some languages there are embeddable javascript engines available, that are specifically designed to be used as scripting engines or stand-alone interpreters. Most popular one is probably Rhino for Java. But for .Net there is also Jint

You can embed the MS-supplied script engines, including JScript and VBScript using the Script Interfaces. But it doesn t look like they re better documented than the open source options.

You could look at SEE: Simple ECMAScript Engine. If you read the intro to the ECMAScript standards, you will notice that the language is actually intended to be used to script objects that are native to your application environment.

I think that a big problem with JS is that people conflate it with DOM which is what would kill any language. Brendan Eich actually set out to implement Scheme in the browser. So when the marketing types insisted on the Java name and curly brackets language, he took the Scheme & Self concepts and wrapped the C-like syntax around it. Oh and it was branded JavaScript even though it has very little in common with Java - but at the time it was the flavour of the day.

MuJS is an embeddable JavaScript interpreter, with an explicit focus on being easy to embed and extend. If you re familiar with the Lua C API, picking up MuJS should be easy.





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签