Quick Nav
See Also
EmbedThis Ejscript™ Overview
Ejscript is a powerful server-side JavaScript framework for web applications. It dramatically eases development by enabling developers to use the same language on the server as in the browser.
The Ejscript language is an extended version of JavaScript that fully supports and complies with the standardized version of JavaScript known as ECMAScript Edition 3 (ECMA-262-3). It adds enhancements for classes, modules, an extensive system library and powerful web framework.
The Ejscript Web Framework provides a complete environment for high-performance web applications. It is a Model / View / Controller web framework with integrated SQLite database and Object Relational Mapper (ORM). It has a library of data-binding Ajax view controls and includes jQuery for client side integration.
Ejscript is fast, compact and is optimized for server-side web applications. A direct-threaded VM and generational garbage collector provide fast runtime execution. A high-level system library of native classes provides C speeds for library methods and an in-memory web server module ensures rapid response for web requests.
Benefits
-
Rapid Development. Ejscript offers the latest in JavaScript language and server-side JavaScript features to enable quick development of web applications.
-
Minimal Resource Requirements. Ejscript is fast and very compact (from 400KB). It demands minimal resources from your system so your system can focus devote vital system resources to running your application.
-
Full ECMAScript Edition 3. Ejscript is not a cut-down portion of JavaScript, rather, Ejscript provides a full, uncompromised, ECMAScript Edition 3 implementation. It extends upon this core with a set of enhancements designed for server-side web applications such as modules and classes.
- Security and Reliability. Ejscript is ideal for embedded applications where uptime and secure execution is paramount. It includes a secure portable runtime to prevent common security flaws.
Features
Ejscript has the features and flexibility to meet the most demanding web and embedded application needs. It can run stand-alone as a language interpreter, or it can be embedded into an existing application.
Ejscript has the following features:
-
Web Framework The Ejscript web framework enables Ajax based web applications with few lines of code. It includes a Model, View, Controller framework, ORM layer, code generator, database migrations, a web page templating engine and a suite of Ajax view controls.
-
High Performance Virtual Machines. Ejscript has a direct-threaded VM with generational garbage collector. It uses a virtual arena-based memory allocator which is specifically designed for applications responding to web reqeusts.
-
Compact Byte Code. Ejscript has an extremely compact, high level byte code. Ideal for server-side web applications.
-
Enhanced Core Language. Ejscript enhances the ECMAScript core with powerful a set of features including: classes and modules for scalable programming, conditional compilation and an enhanced-language mode to detect common JavaScript language issues.
-
Extensive System Class Library. Ejscript goes well beyond the minimal class library available with browser-based JavaScript. Ejscript provides classes for Events, Timers, Files, Paths, Streams, Sockets and HTTP. There are also significant upgrades for the core system classes: Array, Object and String.
-
Great Tools. Ejscript includes a fast, optimizing compiler, symbolic assembler listing generator and documentation generation tool.
-
Embeddable. Ejscript is easily embedded into existing applications and systems. It is highly configurable and supports ROMing of programs and XIP.
-
Portable. Ejscript has clean, modular source code that is cross-platform and easy to port to new platforms or CPU architectures.
See the Ejscript Feature List for an extended list of capabilities.
Standards
Ejscript fully supports and complies with the standardized version of JavaScript known as ECMAScript Edition 3 (ECMA-262-3). Ejscript also implements the ECMAScript E4X for XML (ECMA-357) specification.
The Ejscript development community is also participating in the various JavaScript standards efforts including:
- ECMAScript Harmony — The next generation JavaScript language standards effort.
- ServerJS — An effort to create standardized Server-Side JavaScript libraries.
Ejscript enhances standard JavaScript with the addition of a comprehensive web framework and language extensions such as modules and classes.
Ejscript Design
The goal of Ejscript is to create a standards-based JavaScript environment that excels at hosting server-side JavaScript web applications. Web applications typically require compact and efficient memory utilization and modest CPU requirements. For embedded applications, this is because of device contstraints. For enterprise applications, the necessity to scale requires that web frameworks are highly efficient in memory use.
However, most existing JavaScript implementations are designed for use inside a browser on the PC desktop. They have large memory footprints, typically more than 4MB and often larger than 64MB — not ideal for running server-side and hosting web applications or running in embedded applications.
By contrast, Ejscript, requires from 400K of code and has minimal memory requirements to execute (from 600K). To do this, Ejscript sheds browser baggage and prioritizes design trade-offs toward memory efficiency.
Why Enhance JavaScript?
JavaScript is now one of the most popular programming languages in the world. However, JavaScript was written many years ago during the height of the browser wars. It was written in a hurry and under corporate pressure. As a result, the language has some glaring weaknesses that impact the security of programs and the programming experience of users — especially when used for server-side JavaScript web applications.
Some of the more major issues are:
- JavaScript stores all top-level variables from all source files together in one global object.
- JavaScript fails to provide a scalable module scheme to package and isolate program components and ensure names don't conflict.
- JavaScript does not provide real block scope
- JavaScript allows multiple variable declarations of the same name so variable declarations can silently collide.
- Assignments to undeclared variables in JavaScript functions will often create unwanted global variables.
Ejscript corrects these issues with a set of extensions to the JavaScript language and environment that make Ejscript ideal for server-side web applications.
Ejscript Language Enhancements
Credit where credit is due. Ejscript has learned from the ongoing JavaScript research and standardization efforts and from Adobe's ActionScript. For the Ejscript web framework, Ruby on Rails has also provided many good patterns.
Ejscript adds the following language enhancements:
- Block and file scope
- Module and namespace directives
- Let variable declarations
- Variable visibility controls
- Optional type annotations
- Bound methods that capture the this object
- Function rest arguments
- Class, extends, super and interface directives
- Extended language library: Http, File I/O, Sockets, Stream I/O, XML, Eventing
- E4X XML support
- Iterators and Generators
- Automatic type conversion for function arguments
- Extended try / catch syntax
- Cast, is operators
- Reflection
- Use pragmas
- Assertions
- Conditional compilation
You can choose to take advantage of the enhancements offered by Ejscript for a more secure, scalable and pleasant programming experience or you can can use it in strict ECMAScript compliant mode and utilize only standard features.
Ejscript History
Early versions of Ejscript have been used in the Embedthis Appweb embedded web server for years and is now embedded in millions of devices. The new VM based version has also been used in a range of mobile devices to empower widget-style applications.
Licensing
Ejscript software products are available with either an Open Source or Commercial license. Our products are created using an Open Source development model where a community of developers contribute enhancements and fixes. Products are licensed under the GNU GPL open source license and are provided with full source code.
Embedthis Software has generously provided infrastructure, developers and funding to make this possible and is also providing commercial support and licenses for Ejscript.
Commercial Licenses
Embedthis provides commercial licenses and support. See http://www.embedthis.com for details.