TimeGIS
InfoVista.NET
首页             技术文章             专业软件             管理软件             开源软件             知识分享             网站地图            

 程序开发

      图形编辑器

 开发工具


 Web应用开发


 手机移动开发


 建站系统


 企业应用


 服务器


 数据库


 应用工具


 游戏娱乐


 操作系统


 控制仿真



Jint - Javascript Interpreter for .NET - Home

参考:http://jint.codeplex.com/

Jint - Javascript Interpreter for .NET

Project Description

Jint is a script engine based on the Javascript language. Using Jint, developers can provide fully scriptable applications, execute .NET code without compiling, or create external configuration logic, using the most used script language.
Jint aims at providing every JavaScript functionalities to .NET applications, and bindings to .NET languages can be done in both sides. Jint scripts can use any .NET object from your application, and use every part of the .NET base class library.

Differences with other script engines

Jint is different as it doesn't use CodeDomProvider technique which is using compilation under the hood and thus leads to memory leaks as the compiled assemblies can't be unloaded. Moreover, using this technique prevents using dynamically types variables the way JavaScript does, allowing more flexibility in your scripts. On the opposite, Jint embeds it's own parsing logic, and really interprets the scripts. Jint uses the famous ANTLR (http://www.antlr.org) library for this purpose.
As it uses Javascript as its language you don't have to learn a new language, it has proven to be very powerful for scripting purposes, and you can use several text editors for syntax checking.

Usage scenarios

  • Create applications users can automate by providing a programmable interface. A good example is what VBA is for Microsoft Office applications
  • Enhance configurability to change your application's behavior and logic without compiling or deploying binaries
  • Evaluate dynamic code or expressions

Sample usage

Here is a sample in C#, but any .NET language can use Jint. Jint is able to handle all advanced JavaScript techniques decribed on this MSDN article: http://msdn.microsoft.com/en-us/magazine/cc163419.aspx. It currently implements all concepts defined in ECMAScript version 3.0.

script= @"
  function square(x) { 
    return x * x; 
  };
  
  return square(number);
  ";
  
var result = new JintEngine()
  .SetParameter("number", 3)
  .Run(script));

Assert.AreEqual(9, result);

You can also check the actual implemented test suite for more samples.

Implemented artifacts

  • Standard Javascript elements:
    • Objects and methods
    • Loops (do, while, for)
    • Code blocks and scopes
    • Conditional statements (if, switch/case)
    • Json
    • Property indexers
    • Dynamic properties
    • Javascript native classes (Math, String, Object, Number)
    • Regular expressions
    • Functions (declarations plus anonymous functions)
    • Prototypes and constructors
  • .NET bindings
    • External objects and values
    • External functions to enhance the script resources
    • Return value to .NET code
  • Out of the box Jint Shell application
    • Use Jint on the command line

Deployment

Jint is deployed as a part of your application and fits inside a single assembly. Nothing as to be installed on the client machine.

Roadmap

  • 0.8 - All javascript languages artifacts as of ECMAScript 3.0
  • 0.9 - Beta phase - All javascript core methods are implemented (Math, slice, ...)
  • 1.0 - Positive feedback from Beta
  • 1.1 - ECMAScript 5.0 elements

共107页  第79页  首页  上一页  下一页  尾页


友情链接 尚禹水利环境 | 我行我速 | SharpDevelop | CSLA.NET | CodePlex | 开源中国社区 | 流体中文网 | 水资讯网 | 上帝之眼 FindSim.NET |
本网页由快手工具软件自动生成,感兴趣者请联系我们。