RSX Code Reference
    Preparing search index...
    • rsx
    • JavaScriptCode

    Class JavaScriptCode

    The JavaScriptCode class implements a Resource that contains cooked JavaScript game or editor code.

    Hierarchy (View Summary)

    Index
    • Creates a new script code resource with the specified source code.

      Parameters

      • data: string
      • Optionaluuid: UUID
      • OptionalisInternalConstructor: boolean

      Returns JavaScriptCode

    • get code(): string

      Sets the source code contained in the resource.

      Returns string

    • set code(value: string): void

      Parameters

      • value: string

      Returns void

    • get createdAtMajorEngineVersion(): number

      Indicates the major version of the engine that this resource was created at.

      Returns number

    • get createdAtMinorEngineVersion(): number

      Indicates the minor version of the engine that this resource was created at.

      Returns number

    • get declaration(): string

      Sets the declaration contained in the resource.

      Returns string

    • set declaration(value: string): void

      Parameters

      • value: string

      Returns void

    • get isCompatibleWithCurrentEngineVersion(): boolean

      Determines whether the JavaScriptCode is compatible with the current engine version.

      Returns boolean

    • get isCreatedFromOlderVersion(): boolean

      Determines whether the JavaScriptCode was created on an older engine version.

      Returns boolean

    • get isDestroyed(): boolean

      Determines if the resource is destroyed.

      Returns boolean

      This can happen when the Resource was forcefully unloaded or reverted. For this reason, it is safer to hold on to a instead of directly referencing a resource pointer, as the current Resource can always be retrieved via .value.

    • get minimumMajorEngineVersion(): number

      Indicates the minimum major version of the engine required to load this JavaScript code.

      Returns number

    • set minimumMajorEngineVersion(value: number): void

      Parameters

      • value: number

      Returns void

    • get minimumMinorEngineVersion(): number

      Indicates the minimum minor version of the engine required to load this JavaScript code.

      Returns number

    • set minimumMinorEngineVersion(value: number): void

      Parameters

      • value: number

      Returns void

    • get name(): string

      Name of the resource. Use primarily for easier identification and not important to the engine itself.

      Returns string

    • get uuid(): UUID

      Returns a universally unique identifier of this resource.

      Returns UUID

    • Duplicates the resource and creates a unique UUID for the duplicated resource.

      Returns Resource

      The duplicated resource or null, if the duplication failed.

    • Determines whether the JavaScriptCode is compatible with the specified major and minor engine version.

      Parameters

      • major: number
      • minor: number

      Returns boolean

    • Virtual

      Method called by RSX to perform actions required after the creation of the resource.

      Returns void

    • Virtual

      Method called by RSX to perform any operations needed after deserialization.

      Returns void

      Use this API to restore your serializable data into live objects.

    • Virtual

      Method called by RSX to disable the resource.

      Returns void

      Use this API to deactivate the resource before it is serialized.

    • Virtual

      Method called by RSX to enable the resource.

      Returns void

      Use this API to activate the resource after it has been disabled by serialization.

    • Virtual

      Method called by RSX to perform initialization of the resource.

      Returns void

      Use this API to initialize data and default construct all fields.

    • Virtual

      Method called by RSX to perform any operations before serialization.

      Returns void

      Use this API to bake your live data into serializable data.

    • Reverts the resource to the on-disk representation.

      Returns boolean

      This is a potentially expensive call, as it needs to deserialize and replace all existing in-memory resource handles.