July 18, 2000 - SpiderMonkey and Rhino | WebReference

July 18, 2000 - SpiderMonkey and Rhino

Yehuda Shiran July 18, 2000
SpiderMonkey and Rhino
Tips: July 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

When we talk about JavaScript, we usually refer to the JavaScript interpreter that is provided with Internet Explorer and Netscape Navigator. But what if we want to use JavaScript scripts from within a stand-alone application written in C or Java? Netscape developed the concept of JavaScript engine. This is a piece of compiled code that knows how to interprets JavaScript. It is a shared resource, implemented differently for each platform. On Windows, for example, it is a DLL, while on Unix it is a shared library. You link your application with it and then embed JavaScript engine application programming interface (API) calls in your application. The JavaScript engine's API provides functions of the following types:

Before you can make any JS calls, you must create and initialize the JS engine with a call to JS_NewRuntime function.

Netscape developed two dialects of the JavaScript engine: a C-based engine (called SpiderMonkey) and a Java-based engine (called Rhino). Obviously, you would link your C applications with SpiderMonkey and your Java applications with Rhino.