JavaScript Runtimes

A set of utility classes to execute code on a few JavaScript runtimes.

Categories

Categories

JavaScript Languages
GroupId

GroupId

org.slieb
ArtifactId

ArtifactId

js-runtimes
Last Version

Last Version

1.1
Release Date

Release Date

Type

Type

jar
Description

Description

JavaScript Runtimes
A set of utility classes to execute code on a few JavaScript runtimes.
Project URL

Project URL

http://stefanliebenberg.github.io/js-runtimes/
Source Code Management

Source Code Management

https://github.com/StefanLiebenberg/js-runtimes

Download js-runtimes

How to add to project

<!-- https://jarcasting.com/artifacts/org.slieb/js-runtimes/ -->
<dependency>
    <groupId>org.slieb</groupId>
    <artifactId>js-runtimes</artifactId>
    <version>1.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.slieb/js-runtimes/
implementation 'org.slieb:js-runtimes:1.1'
// https://jarcasting.com/artifacts/org.slieb/js-runtimes/
implementation ("org.slieb:js-runtimes:1.1")
'org.slieb:js-runtimes:jar:1.1'
<dependency org="org.slieb" name="js-runtimes" rev="1.1">
  <artifact name="js-runtimes" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.slieb', module='js-runtimes', version='1.1')
)
libraryDependencies += "org.slieb" % "js-runtimes" % "1.1"
[org.slieb/js-runtimes "1.1"]

Dependencies

compile (3)

Group / Artifact Type Version
org.mozilla : rhino jar 1.7.6
commons-io : commons-io jar 2.4
com.google.guava : guava jar 18.0

provided (1)

Group / Artifact Type Version
org.seleniumhq.selenium : selenium-remote-driver Optional jar 2.45.0

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.mockito : mockito-all jar 2.0.2-beta

Project Modules

There are no modules declared in this project.

js-runtimes

Interface

JavaScriptRuntime is a simple interface intented for use in libraries that want to remain agnostic as to which runtime they are operating on.

Implementations:

###RhinoRuntime

The rhino runtime provides a wrapper around the rhino javascript engine.

  RhinoRuntime runtime = new RhinoRuntime();
  runtime.initialize();
  runtime.execute("var x = 1;", "/path.js");
  runtime.execute("x;"); // 1
  runtime.close();

###EnvJsRuntime

This runtime extends the rhino runtime and adds envjs support for the DOM.

  EnvJsRuntime runtime = new EvnJsRuntime();
  runtime.initialize();
  // do stuff with runtime
  runtime.close();

Misc

Note: This repo contains a monkey patched version of rhino's BaseFunction class to lend support to Function.caller from inside some functions.

Versions

Version
1.1
1.0