Options
All
  • Public
  • Public/Protected
  • All
Menu

Module rhino

The rhino module provides rhino engine-compatible Java interaction APIs, such as importing Java packages, classes, and JavaAdapter (not yet implemented).

Index

Variables

Functions

Variables

Const Packages

Packages: JavaPackages = ...

Variable to access Java package or class. For example, Packages.java or Packages.kotlin.

example
"nodejs";
const { Packages } = require("rhino");

const OkHttpClient = Packages.okhttp3.OkHttpClient;
const client = new OkHttpClient.Builder().build();

console.log(client);

Functions

install

  • install(scope?: any): void
  • Install compatibility variables and functions for Rhino engine Java interaction, currently supports:

    • Packages variable, to access Java package or class
    • java, javax, org, com, edu, net, android packages, to access common Java packages and classes
    • JavaAdapter class, to implement Java class or interface dynamically in JavaScript. Currently not supported, will be supported in a future version

    Not supported importClass and importPackage functions, please use assignment statement instead.

    example
    "nodejs";
    require("rhino").install();
    
    const View = android.view.View;
    const StringBuilder = java.lang.StringBuilder;
    
    console.log(View.class.getName());
    console.log(new StringBuilder().append("Hello").toString());
    
    

    Parameters

    • scope: any = ...

    Returns void