Skip to content

infinity

Provides system-level information and functionality as well as script inclusion, module loading, process delaying and error reporting possibilities.

Module: none (built-in)


Interfaces

stringArray

Extends: Array<string>

An array of strings.


Functions

beep()

Plays a notifying system sound.

Signature:

beep(): void

Example:

infinity.beep();

gc()

Triggers the garbage collector.

Signature:

gc(): void

Example:

infinity.gc();

getArgs()

Returns the arguments, which the INFINITY.JS executable file has been started with.

Signature:

getArgs(): stringArray

Return type: stringArray

Example:

let x = infinity.getArgs();

getGlobal()

Returns the value of the specified global variable.

Signature:

getGlobal( name: string ): any

Parameters:

  • name: string

    The name of the global variable.

Return type: any

Example:

let value = infinity.getGlobal(name);

include()

Includes the specified script file and executes its contents at the position include() has been called.

Signature:

include( fileName: string ): void

Parameters:

  • fileName: string

    The name of the file to be included. The position is automatically assumed at the js - output folder inside the project folder. Keep in mind that output - files with the ending .js should be referenced.

Example:

infinity.include('includeTest.js');

loadModule()

Loads the specified INFINITY.JS module, making its functionality usable for the current process.

Signature:

loadModule( moduleName: string ): void

Parameters:

  • moduleName: string

    The identifier of the module to be loaded.

Example:

infinity.loadModule(moduleName);

sendSentryEvent()

INFINITY.JS supports error reporting to the remote error monitoring service sentry.io. Settings like the DSN as well as the HandleNativeExceptions, HandleRuntimeExceptions and HandleScriptExceptions flags have to be placed inside the [Sentry] - block of your .ini configuration file in the folder containing the used INFINITY.JS executable file.

Signature:

sendSentryEvent( message: string, level?: string, processInfo?: boolean ): void

Parameters:

  • message: string

    The error message to be sent to sentry.io.

  • level: string, optional

    The error level on the occurance of which the message should be sent.

  • processInfo: boolean, optional

    Specifies whether additional technical debug data should be sent with the message.

Example:

infinity.sendSentryEvent('Error 123');

ini-file:

[Sentry]
HandleNativeExceptions=0
HandleRuntimeExceptions=0
HandleScriptExceptions=0
DSN="https://public@sentry.example.com/1"

sleep()

Delays the further execution of the current INFINITY.JS process for the specified amount of milliseconds.

Signature:

sleep( milliSeconds: number ): void

Parameters:

  • milliSeconds: number

    The amount of milliseconds for the delay.

Example:

infinity.sleep(1000);
//a 1-second delay

terminate()

Sets the infinity.terminated property for the running INFINITY.JS instance to true. This way, the message for process termination can be sent throughout multiple threads. Through corresponding checks, the actual termination of the process can be carried out.

Signature:

terminate(): void

Example:

console.debug(infinity.terminated);//false
infinity.terminate();
console.debug(infinity.terminated);//true

Properties

terminated

Type: boolean

Indicates whether the infinity.terminate() has been called.


threadTerminated

Type: boolean

Indicates whether the thread has been terminated. This value only has meaning inside a script that is executed as a thread. Inside a thread, make sure that you check this value in your thread's main loop and let your thread terminate gracefully when the value is true.