Options
All
  • Public
  • Public/Protected
  • All
Menu

Strange Eons JS API

Index

Modules

Interfaces

Type aliases

Variables

Functions

Type aliases

ArrayBufferLike

ArrayBufferLike: ArrayBuffer

ClassDecorator

ClassDecorator: function

Type declaration

    • <TFunction>(target: TFunction): TFunction | void
    • Type parameters

      • TFunction: Function

      Parameters

      • target: TFunction

      Returns TFunction | void

ConstructorParameters

ConstructorParameters: ConstructorParameters<T>

Obtain the parameters of a constructor function type in a tuple

Exclude

Exclude: Exclude<T, U>

Exclude from T those types that are assignable to U

Extract

Extract: Extract<T, U>

Extract from T those types that are assignable to U

InstanceType

InstanceType: InstanceType<T>

Obtain the return type of a constructor function type

MethodDecorator

MethodDecorator: function

Type declaration

NonNullable

NonNullable: NonNullable<T>

Exclude null and undefined from T

ParameterDecorator

ParameterDecorator: function

Type declaration

    • (target: Object, propertyKey: string | symbol, parameterIndex: number): void
    • Parameters

      • target: Object
      • propertyKey: string | symbol
      • parameterIndex: number

      Returns void

Parameters

Parameters: Parameters<T>

Obtain the parameters of a function type in a tuple

Partial

Partial: object

Make all properties in T optional

Type declaration

Pick

Pick: object

From T, pick a set of properties whose keys are in the union K

Type declaration

PromiseConstructorLike

PromiseConstructorLike: object

Type declaration

PropertyDecorator

PropertyDecorator: function

Type declaration

    • (target: Object, propertyKey: string | symbol): void
    • Parameters

      • target: Object
      • propertyKey: string | symbol

      Returns void

PropertyKey

PropertyKey: string | number | symbol

Readonly

Readonly: object

Make all properties in T readonly

Type declaration

Record

Record: object

Construct a type with a set of properties K of type T

Type declaration

Required

Required: object

Make all properties in T required

Type declaration

ReturnType

ReturnType: ReturnType<T>

Obtain the return type of a function type

Variables

Const Array

Array: ArrayConstructor

Const ArrayBuffer

Const Boolean

Const DataView

Const Date

Date: DateConstructor

Const Error

Const EvalError

Const Float32Array

Const Float64Array

Const Function

Const Infinity

Infinity: number

Const Int16Array

Const Int32Array

Const Int8Array

Const JSON

JSON: JSON

An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.

Const Math

Math: Math

An intrinsic object that provides basic mathematics functionality and constants.

Const NaN

NaN: number

Const Number

Number: NumberConstructor

An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers.

Const Object

Object: ObjectConstructor

Provides functionality common to all JavaScript objects.

Const Packages

Packages: JavaPackage<"">

The Packages constant provides access to the entire Strange Eons Java API. It reflects the root of the Java class path as a JavaPackage object.

For example: Packages.java.lang.String Packages.ca.cgjennings.apps.arkham.StrangeEons

As a convenience, the common library predefines a number of shortcuts to commonly used packages, including java, javax, swing (short for javax.swing), ca (root of most Strange Eons classes), arkham (short for ca.cgjennings.apps.arkham, the most commonly used part of the API), resources (where ResourceKit and Language live), and gamedata (where the classes for parsing and registering new content live).

Classes and packages can be added to the global namespace using the importClass and importPackage functions.

More about accessing the Java API from script code

API documentation ("Javadocs")

Const RangeError

Const ReferenceError

Const RegExp

RegExp: RegExpConstructor

Const String

String: StringConstructor

Allows manipulation and formatting of text strings and determination and location of substrings within strings.

Const SyntaxError

Const TypeError

Const URIError

Const Uint16Array

Const Uint32Array

Const Uint8Array

Const Uint8ClampedArray

Uint8ClampedArray: Uint8ClampedArrayConstructor

Functions

decodeURI

  • decodeURI(encodedURI: string): string
  • Gets the unencoded version of an encoded Uniform Resource Identifier (URI).

    Parameters

    • encodedURI: string

      A value representing an encoded URI.

    Returns string

decodeURIComponent

  • decodeURIComponent(encodedURIComponent: string): string
  • Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).

    Parameters

    • encodedURIComponent: string

      A value representing an encoded URI component.

    Returns string

encodeURI

  • encodeURI(uri: string): string
  • Encodes a text string as a valid Uniform Resource Identifier (URI)

    Parameters

    • uri: string

      A value representing an encoded URI.

    Returns string

encodeURIComponent

  • encodeURIComponent(uriComponent: string): string
  • Encodes a text string as a valid component of a Uniform Resource Identifier (URI).

    Parameters

    • uriComponent: string

      A value representing an encoded URI component.

    Returns string

escape

  • escape(string: string): string
  • Computes a new string in which certain characters have been replaced by a hexadecimal escape sequence.

    Parameters

    • string: string

      A string value

    Returns string

eval

  • eval(x: string): any
  • Evaluates JavaScript code and executes it.

    Parameters

    • x: string

      A String value that contains valid JavaScript code.

    Returns any

importClass

  • importClass(javaClass: JavaClass<any>): void
  • Imports a class into the global scope so that it can be used by its short class name. The effect is similar to using a Java import statement. For example, the following code would import the class java.io.File so that it can be referred to simply as File:

    importClass(java.io.File);
    
    let currentDir = new File(".");
    println(currentDir.isDirectory());
    println(currentDir.lastModified());

    The name is always added to the global scope of the script, even if called from another scope (such as inside of a function). Importing a class will fail if the class's short name is already in use. In that case, you can instead assign the class to a name of your choice:

    const javaString = java.lang.String;
    see

    Packages

    Parameters

    • javaClass: JavaClass<any>

      the Java class whose class name should be added to the global scope

    Returns void

importPackage

  • Imports all of the classes in a Java package into the script. The effect is similar to using a Java import statement with .* after the package name. When the script engine looks for a variable name, if it isn't defined in the current scope then before issuing an error it will check all of the imported packages to see if they contain a class of the same name, and if so that class will be imported. For example, in the following code File will match the class java.io.File from the java.io package, and this be implicitly imported:

    importPackage(java.io);
    println(File.listRoots());
    see

    Packages

    Parameters

    • javaPackage: JavaPackage<any>

      the package to add to the list of packages to search for class names that match unknown variables

    Returns void

isFinite

  • isFinite(number: number): boolean
  • Determines whether a supplied number is finite.

    Parameters

    • number: number

      Any numeric value.

    Returns boolean

isNaN

  • isNaN(number: number): boolean
  • Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number).

    Parameters

    • number: number

      A numeric value.

    Returns boolean

parseFloat

  • parseFloat(string: string): number
  • Converts a string to a floating-point number.

    Parameters

    • string: string

      A string that contains a floating-point number.

    Returns number

parseInt

  • parseInt(s: string, radix?: number): number
  • Converts A string to an integer.

    Parameters

    • s: string

      A string to convert into a number.

    • Optional radix: number

      A value between 2 and 36 that specifies the base of the number in numString. If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. All other strings are considered decimal.

    Returns number

unescape

  • unescape(string: string): string
  • Computes a new string in which hexadecimal escape sequences are replaced with the character that it represents.

    Parameters

    • string: string

      A string value

    Returns string