Script

Description

Supported Script Types: Interface Scripts • Client Entity Scripts • Avatar Scripts • Server Entity Scripts • Assignment Client Scripts

The Script API provides facilities for working with scripts.

Properties

Name Type Summary
context string

The context that the script is running in:

  • "client": An Interface or avatar script.
  • "entity_client": A client entity script.
  • "entity_server": A server entity script.
  • "agent": An assignment client script.
Read-only.

Methods

Name Return Value Summary
_requireResolve string

Deprecated: This function is deprecated and will be removed.

addEventHandler None

Adds a function to the list of functions called when an entity event occurs on a particular entity.

See also, the Entities API.

beginProfileRange None

Starts timing a section of code in order to send usage data about it to High Fidelity. Shouldn't be used outside of the standard scripts.

callAnimationStateHandler None

Deprecated: This function is deprecated and will be removed.

callEntityScriptMethod None

Calls a method in an entity script.

Deprecated: This function is deprecated and will be removed.

callEntityScriptMethod None

Calls a method in an entity script.

Deprecated: This function is deprecated and will be removed.

callEntityScriptMethod None

Calls a method in an entity script.

clearInterval None

Stops an interval timer set by setInterval.

clearTimeout None

Stops a timeout timer set by setTimeout.

endProfileRange None

Finishes timing a section of code in order to send usage data about it to High Fidelity. Shouldn't be used outside of the standard scripts.

entityScriptContentAvailable None

Deprecated: This function is deprecated and will be removed.

evaluate object

Deprecated: This function is deprecated and will be removed.

evaluateInClosure object

Deprecated: This function is deprecated and will be removed.

executeOnScriptThread None

Deprecated: This function is deprecated and will be removed.

formatExecption string

Deprecated: This function is deprecated and will be removed.

generateUUID Uuid

Deprecated: This function is deprecated and will be removed. Use Uuid.generate instead.

getContext string

Gets the context that the script is running in: Interface/avatar, client entity, server entity, or assignment client.

include None

Includes JavaScript from another file in the current script. If a callback is specified, the file is loaded and included asynchronously, otherwise it is included synchronously (i.e., script execution blocks while the file is included).

include None

Includes JavaScript from other files in the current script. If a callback is specified, the files are loaded and included asynchronously, otherwise they are included synchronously (i.e., script execution blocks while the files are included).

isAgentScript boolean

Checks whether the script is running as an assignment client script.

isClientScript boolean

Checks whether the script is running as an Interface or avatar script.

isDebugMode boolean

Checks whether the application was compiled as a debug build.

isEntityClientScript boolean

Checks whether the script is running as a client entity script.

isEntityScriptRunning boolean

Checks whether an entity has an entity script running.

isEntityServerScript boolean

Checks whether the script is running as a server entity script.

lintScript object

Deprecated: This function is deprecated and will be removed.

load None

Starts running another script in Interface, if it isn't already running. The script is not automatically loaded next time Interface starts.

Supported Script Types: Interface Scripts • Avatar Scripts

See also, ScriptDiscoveryService.loadScript.

loadEntityScript None

Deprecated: This function is deprecated and will be removed.

makeError object

Deprecated: This function is deprecated and will be removed.

print None

Prints a message to the program log.

Alternatively, you can use print, console.log, or one of the other console methods.

registerFunction None

Deprecated: This function is deprecated and will be removed.

registerFunction None

Deprecated: This function is deprecated and will be removed.

registerGetterSetter None

Deprecated: This function is deprecated and will be removed.

registerGlobalObject None

Deprecated: This function is deprecated and will be removed.

registerValue None

Deprecated: This function is deprecated and will be removed.

removeEventHandler None

Removes a function from the list of functions called when an entity event occurs on a particular entity.

See also, the Entities API.

requestGarbageCollection None

Manually runs the JavaScript garbage collector which reclaims memory by disposing of objects that are no longer reachable.

require object | array

Provides access to methods or objects provided in an external JavaScript or JSON file. See https://docs.highfidelity.com/script/js-tips.html for further details.

resetModuleCache None

Deprecated: This function is deprecated and will be removed.

resolvePath string

Resolves a relative path to an absolute path. The relative path is relative to the script's location.

resourcesPath string

Gets the path to the resources directory for QML files.

setInterval object

Calls a function repeatedly, at a set interval.

setTimeout object

Calls a function once, after a delay.

stop None

Stops and unloads the current script.

Warning: If an assignment client script, the script gets restarted after stopping.

unloadAllEntityScripts None

Deprecated: This function is deprecated and will be removed.

unloadEntityScript None

Deprecated: This function is deprecated and will be removed.

updateMemoryCost None

Deprecated: This function is deprecated and will be removed.

Signals

Name Summary
cleanupMenuItem

Deprecated: This signal is deprecated and will be removed.

clearDebugWindow

Deprecated: This signal is deprecated and will be removed.

doneRunning

Triggered when the script has stopped.

entityScriptDetailsUpdated

Deprecated: This signal is deprecated and will be removed.

entityScriptPreloadFinished

Triggered when the script starts for the user. See also, Entities.preload.

Supported Script Types: Client Entity Scripts • Server Entity Scripts

errorLoadingScript

Deprecated: This signal is deprecated and will be removed.

errorMessage

Triggered when the script generates an error or console.error is called.

finished

Deprecated: This signal is deprecated and will be removed.

infoMessage

Triggered when the script generates an information message or console.info is called.

loadScript

Deprecated: This signal is deprecated and will be removed.

printedMessage

Triggered when the script prints a message to the program log via print, Script.print, console.log, or console.debug.

reloadScript

Deprecated: This signal is deprecated and will be removed.

runningStateChanged

Triggered when the running state of the script changes, e.g., from running to stopping.

scriptEnding

Triggered when the script is stopping.

scriptLoaded

Deprecated: This signal is deprecated and will be removed.

signalHandlerException

Deprecated: This signal is deprecated and will be removed.

unhandledException

Triggered when a script generates an unhandled exception.

update

Triggered frequently at a system-determined interval.

warningMessage

Triggered when the script generates a warning or console.warn is called.

Type Definitions

EntityEvent
Type: string

The name of an entity event. When the entity event occurs, any function that has been registered for that event via Script.addEventHandler is called with parameters per the entity event.

Event NameEntity Event
"enterEntity"Entities.enterEntity
"leaveEntity"Entities.leaveEntity
"mousePressOnEntity"Entities.mousePressOnEntity
"mouseMoveOnEntity"Entities.mouseMoveOnEntity
"mouseReleaseOnEntity"Entities.mouseReleaseOnEntity
"clickDownOnEntity"Entities.clickDownOnEntity
"holdingClickOnEntity"Entities.holdingClickOnEntity
"clickReleaseOnEntity"Entities.clickReleaseOnEntity
"hoverEnterEntity"Entities.hoverEnterEntity
"hoverOverEntity"Entities.hoverOverEntity
"hoverLeaveEntity"Entities.hoverLeaveEntity
"collisionWithEntity"Entities.collisionWithEntity

Method Details

(static) _requireResolve( module, relativeToopt ) → {string}
Returns: Result.

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Attributes Default Value Description
module string

Module.

relativeTo string <optional>
""

Relative to.

(static) addEventHandler( entityID, eventName, handler )

Adds a function to the list of functions called when an entity event occurs on a particular entity.

See also, the Entities API.

Parameters

Name Type Description
entityID Uuid

The ID of the entity.

eventName Script.EntityEvent

The name of the entity event.

handler function

The function to call when the entity event occurs on the entity. It can be either the name of a function or an in-line definition.

Example

Report when a mouse press occurs on a particular entity.

var entityID = Entities.addEntity({
    type: "Box",
    position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })),
    dimensions: { x: 0.5, y: 0.5, z: 0.5 },
    lifetime: 300  // Delete after 5 minutes.
});

function reportMousePress(entityID, event) {
    print("Mouse pressed on entity: " + JSON.stringify(event));
}

Script.addEventHandler(entityID, "mousePressOnEntity", reportMousePress);
(static) beginProfileRange( label )

Starts timing a section of code in order to send usage data about it to High Fidelity. Shouldn't be used outside of the standard scripts.

Parameters

Name Type Description
label string

A name that identifies the section of code.

(static) callAnimationStateHandler( callback, parameters, names, useNames, resultHandler )

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Description
callback function

Callback function.

parameters object

Parameters.

names Array.<string>

Names.

useNames boolean

Use names.

resultHandler function

Result handler.

(static) callEntityScriptMethod( entityID, methodName, otherID, collision )

Calls a method in an entity script.

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Description
entityID Uuid

Entity ID.

methodName string

Method name.

otherID Uuid

Other entity ID.

collision Collision

Collision.

(static) callEntityScriptMethod( entityID, methodName, event )

Calls a method in an entity script.

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Description
entityID Uuid

Entity ID.

methodName string

Method name.

event PointerEvent

Pointer event.

(static) callEntityScriptMethod( entityID, methodName, parametersopt, remoteCallerIDopt )

Calls a method in an entity script.

Parameters

Name Type Attributes Default Value Description
entityID Uuid

The ID of the entity running the entity script.

methodName string

The name of the method to call.

parameters Array.<string> <optional>
[]

The parameters to call the specified method with.

remoteCallerID Uuid <optional>
Uuid.NULL

An ID that identifies the caller.

(static) clearInterval( timer )

Stops an interval timer set by setInterval.

Parameters

Name Type Description
timer object

The interval timer to stop.

Example

Stop an interval timer.

// Print a message every second.
var timer = Script.setInterval(function () {
    print("Interval timer fired");
}, 1000);

// Stop the timer after 10 seconds.
Script.setTimeout(function () {
    print("Stop interval timer");
    Script.clearInterval(timer);
}, 10000);
(static) clearTimeout( timer )

Stops a timeout timer set by setTimeout.

Parameters

Name Type Description
timer object

The timeout timer to stop.

Example

Stop a timeout timer.

// Print a message after two seconds.
var timer = Script.setTimeout(function () {
    print("Timer fired");
}, 2000);

// Uncomment the following line to stop the timer from firing.
//Script.clearTimeout(timer);
(static) endProfileRange( label )

Finishes timing a section of code in order to send usage data about it to High Fidelity. Shouldn't be used outside of the standard scripts.

Parameters

Name Type Description
label string

A name that identifies the section of code.

(static) entityScriptContentAvailable( entityID, scriptOrURL, contents, isURL, success, status )

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Description
entityID Uuid

Entity ID.

scriptOrURL string

Path.

contents string

Contents.

isURL boolean

Is a URL.

success boolean

Success.

status string

Status.

(static) evaluate( program, filename, lineNumberopt ) → {object}
Returns: Object.

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Attributes Default Value Description
program string

Program.

filename string

File name.

lineNumber number <optional>
-1

Line number.

(static) evaluateInClosure( locals, program ) → {object}
Returns: Object.

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Description
locals object

Locals.

program object

Program.

(static) executeOnScriptThread( function, typeopt )

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Attributes Default Value Description
function function

Function.

type ConnectionType <optional>
2

Connection type.

(static) formatExecption( exception, inludeExtendeDetails ) → {string}
Returns: String.

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Description
exception object

Exception.

inludeExtendeDetails boolean

Include extended details.

(static) generateUUID( ) → {Uuid}
Returns: A new UUID.

Deprecated: This function is deprecated and will be removed. Use Uuid.generate instead.

(static) getContext( ) → {string}
Returns: The context that the script is running in:
  • "client": An Interface or avatar script.
  • "entity_client": A client entity script.
  • "entity_server": A server entity script.
  • "agent": An assignment client script.

Gets the context that the script is running in: Interface/avatar, client entity, server entity, or assignment client.

(static) include( filename, callbackopt )

Includes JavaScript from another file in the current script. If a callback is specified, the file is loaded and included asynchronously, otherwise it is included synchronously (i.e., script execution blocks while the file is included).

Parameters

Name Type Attributes Default Value Description
filename string

The URL of the script to include. It can be relative to the current script.

callback function <optional>
null

The function to call back when the script has been included. It can be either the name of a function or an in-line definition.

Example

Include a script file asynchronously.

// First file: scriptA.js
print("This is script A");

// Second file: scriptB.js
print("This is script B");
Script.include("scriptA.js", function () {
    print("Script A has been included");
});

// If you run scriptB.js you should see only scriptB.js in the running scripts list.
// And you should see the following output:
// This is script B
// This is script A
// Script A has been included
(static) include( filenames, callbackopt )

Includes JavaScript from other files in the current script. If a callback is specified, the files are loaded and included asynchronously, otherwise they are included synchronously (i.e., script execution blocks while the files are included).

Parameters

Name Type Attributes Default Value Description
filenames Array.<string>

The URLs of the scripts to include. Each can be relative to the current script.

callback function <optional>
null

The function to call back when the scripts have been included. It can be either the name of a function or an in-line definition.

(static) isAgentScript( ) → {boolean}
Returns: true if the script is running as an assignment client script, false if it isn't.

Checks whether the script is running as an assignment client script.

(static) isClientScript( ) → {boolean}
Returns: true if the script is running as an Interface or avatar script, false if it isn't.

Checks whether the script is running as an Interface or avatar script.

(static) isDebugMode( ) → {boolean}
Returns: true if the application was compiled as a debug build, false if it was compiled as a release build.

Checks whether the application was compiled as a debug build.

(static) isEntityClientScript( ) → {boolean}
Returns: true if the script is running as a client entity script, false if it isn't.

Checks whether the script is running as a client entity script.

(static) isEntityScriptRunning( entityID ) → {boolean}
Returns: true if the entity has an entity script running, false if it doesn't.

Checks whether an entity has an entity script running.

Parameters

Name Type Description
entityID Uuid

The ID of the entity.

(static) isEntityServerScript( ) → {boolean}
Returns: true if the script is running as a server entity script, false if it isn't.

Checks whether the script is running as a server entity script.

(static) lintScript( sourceCode, fileName, lineNumberopt ) → {object}
Returns: Object.

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Attributes Default Value Description
sourceCode string

Source code.

fileName string

File name.

lineNumber number <optional>
1

Line number.

(static) load( filename )

Starts running another script in Interface, if it isn't already running. The script is not automatically loaded next time Interface starts.

Supported Script Types: Interface Scripts • Avatar Scripts

See also, ScriptDiscoveryService.loadScript.

Parameters

Name Type Description
filename string

The URL of the script to load. This can be relative to the current script's URL.

Example

Load a script from another script.

// First file: scriptA.js
print("This is script A");

// Second file: scriptB.js
print("This is script B");
Script.load("scriptA.js");

// If you run scriptB.js you should see both scripts in the Running Scripts dialog.
// And you should see the following output:
// This is script B
// This is script A
(static) loadEntityScript( entityID, script, forceRedownload )

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Description
entityID Uuid

Entity ID.

script string

Script.

forceRedownload boolean

Force re-download.

(static) makeError( otheropt, typeopt ) → {object}
Returns: Object.

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Attributes Default Value Description
other object <optional>

Other.

type string <optional>
"Error"

Error.

(static) print( message )

Prints a message to the program log.

Alternatively, you can use print, console.log, or one of the other console methods.

Parameters

Name Type Description
message string

The message to print.

(static) registerFunction( name, function, numArgumentsopt )

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Attributes Default Value Description
name string

Name.

function function

Function.

numArguments number <optional>
-1

Number of arguments.

(static) registerFunction( parent, name, function, numArgumentsopt )

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Attributes Default Value Description
parent string

Parent.

name string

Name.

function function

Function.

numArguments number <optional>
-1

Number of arguments.

(static) registerGetterSetter( name, getter, setter, parentopt )

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Attributes Default Value Description
name string

Name.

getter function

Getter.

setter function

Setter.

parent string <optional>
""

Parent.

(static) registerGlobalObject( name, object )

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Description
name string

Name.

object object

Object.

(static) registerValue( name, value )

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Description
name string

Name.

value object

Value.

(static) removeEventHandler( entityID, eventName, handler )

Removes a function from the list of functions called when an entity event occurs on a particular entity.

See also, the Entities API.

Parameters

Name Type Description
entityID Uuid

The ID of the entity.

eventName Script.EntityEvent

The name of the entity event.

handler function

The name of the function to no longer call when the entity event occurs on the entity.

(static) requestGarbageCollection( )

Manually runs the JavaScript garbage collector which reclaims memory by disposing of objects that are no longer reachable.

(static) require( module ) → {object|array}
Returns: The value assigned to module.exports in the JavaScript file, or the value defined in the JSON file.

Provides access to methods or objects provided in an external JavaScript or JSON file. See https://docs.highfidelity.com/script/js-tips.html for further details.

Parameters

Name Type Description
module string

The module to use. May be a JavaScript file, a JSON file, or the name of a system module such as "appUi" (i.e., the "appUi.js" system module JavaScript file).

(static) resetModuleCache( deleteScriptCacheopt )

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Attributes Default Value Description
deleteScriptCache boolean <optional>
false

Delete script cache.

(static) resolvePath( path ) → {string}
Returns: The absolute path.

Resolves a relative path to an absolute path. The relative path is relative to the script's location.

Parameters

Name Type Description
path string

The relative path to resolve.

Examples

Report the directory and filename of the running script.

print(Script.resolvePath(""));

Report the directory of the running script.

print(Script.resolvePath("."));

Report the path to a file located relative to the running script.

print(Script.resolvePath("../assets/sounds/hello.wav"));
(static) resourcesPath( ) → {string}
Returns: The path to the resources directory for QML files.

Gets the path to the resources directory for QML files.

(static) setInterval( function, interval ) → {object}
Returns: A handle to the interval timer. This can be used in Script.clearInterval.

Calls a function repeatedly, at a set interval.

Parameters

Name Type Description
function function

The function to call. This can be either the name of a function or an in-line definition.

interval number

The interval at which to call the function, in ms.

Example

Print a message every second.

Script.setInterval(function () {
    print("Interval timer fired");
}, 1000);
(static) setTimeout( function, timeout ) → {object}
Returns: A handle to the timeout timer. This can be used in Script.clearTimeout.

Calls a function once, after a delay.

Parameters

Name Type Description
function function

The function to call. This can be either the name of a function or an in-line definition.

timeout number

The delay after which to call the function, in ms.

Example

Print a message once, after a second.

Script.setTimeout(function () {
    print("Timeout timer fired");
}, 1000);
(static) stop( marshalopt )

Stops and unloads the current script.

Warning: If an assignment client script, the script gets restarted after stopping.

Parameters

Name Type Attributes Default Value Description
marshal boolean <optional>
false

Marshal.

Deprecated: This parameter is deprecated and will be removed.

Example

Stop a script after 5s.

Script.setInterval(function () {
    print("Hello");
}, 1000);

Script.setTimeout(function () {
    Script.stop(true);
}, 5000);
(static) unloadAllEntityScripts( blockingCallopt )

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Attributes Default Value Description
blockingCall boolean <optional>
false

Wait for completion if call moved to another thread.

(static) unloadEntityScript( entityID, shouldRemoveFromMapopt )

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Attributes Default Value Description
entityID Uuid

Entity ID.

shouldRemoveFromMap boolean <optional>
false

Should remove from map.

(static) updateMemoryCost( deltaSize )

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Description
deltaSize number

Delta size.

Signal Details

cleanupMenuItem( menuItem )
Returns: Signal

Deprecated: This signal is deprecated and will be removed.

Parameters

Name Type Description
menuItem string

Menu item.

clearDebugWindow( )
Returns: Signal

Deprecated: This signal is deprecated and will be removed.

doneRunning( )
Returns: Signal

Triggered when the script has stopped.

entityScriptDetailsUpdated( )
Returns: Signal

Deprecated: This signal is deprecated and will be removed.

entityScriptPreloadFinished( entityID )
Returns: Signal

Triggered when the script starts for the user. See also, Entities.preload.

Supported Script Types: Client Entity Scripts • Server Entity Scripts

Parameters

Name Type Description
entityID Uuid

The ID of the entity that the script is running in.

Example

Get the ID of the entity that a client entity script is running in.

var entityScript = function () {
    this.entityID = Uuid.NULL;
};

Script.entityScriptPreloadFinished.connect(function (entityID) {
    this.entityID = entityID;
    print("Entity ID: " + this.entityID);
});

var entityID = Entities.addEntity({
    type: "Box",
    position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })),
    dimensions: { x: 0.5, y: 0.5, z: 0.5 },
    color: { red: 255, green: 0, blue: 0 },
    script: "(" + entityScript + ")",  // Could host the script on a Web server instead.
    lifetime: 300  // Delete after 5 minutes.
});
errorLoadingScript( filename )
Returns: Signal

Deprecated: This signal is deprecated and will be removed.

Parameters

Name Type Description
filename string

File name.

errorMessage( message, scriptName )
Returns: Signal

Triggered when the script generates an error or console.error is called.

Parameters

Name Type Description
message string

The error message.

scriptName string

The name of the script that generated the error message.

finished( filename, engine )
Returns: Signal

Deprecated: This signal is deprecated and will be removed.

Parameters

Name Type Description
filename string

File name.

engine object

Engine.

infoMessage( message, scriptName )
Returns: Signal

Triggered when the script generates an information message or console.info is called.

Parameters

Name Type Description
message string

The information message.

scriptName string

The name of the script that generated the information message.

loadScript( scriptName, isUserLoaded )
Returns: Signal

Deprecated: This signal is deprecated and will be removed.

Parameters

Name Type Description
scriptName string

Script name.

isUserLoaded boolean

Is user loaded.

printedMessage( message, scriptName )
Returns: Signal

Triggered when the script prints a message to the program log via print, Script.print, console.log, or console.debug.

Parameters

Name Type Description
message string

The message.

scriptName string

The name of the script that generated the message.

reloadScript( scriptName, isUserLoaded )
Returns: Signal

Deprecated: This signal is deprecated and will be removed.

Parameters

Name Type Description
scriptName string

Script name.

isUserLoaded boolean

Is user loaded.

runningStateChanged( )
Returns: Signal

Triggered when the running state of the script changes, e.g., from running to stopping.

scriptEnding( )
Returns: Signal

Triggered when the script is stopping.

Example

Report when a script is stopping.

print("Script started");

Script.scriptEnding.connect(function () {
    print("Script ending");
});

Script.setTimeout(function () {
    print("Stopping script");
    Script.stop();
}, 1000);
scriptLoaded( filename )
Returns: Signal

Deprecated: This signal is deprecated and will be removed.

Parameters

Name Type Description
filename string

File name.

signalHandlerException( exception )
Returns: Signal

Deprecated: This signal is deprecated and will be removed.

Parameters

Name Type Description
exception object

Exception.

unhandledException( exception )
Returns: Signal

Triggered when a script generates an unhandled exception.

Parameters

Name Type Description
exception object

The details of the exception.

Example

Report the details of an unhandled exception.

Script.unhandledException.connect(function (exception) {
    print("Unhandled exception: " + JSON.stringify(exception));
});
var properties = JSON.parse("{ x: 1"); // Invalid JSON string.
     
update( deltaTime )
Returns: Signal

Triggered frequently at a system-determined interval.

Parameters

Name Type Description
deltaTime number

The time since the last update, in s.

Example

Report script update intervals.

Script.update.connect(function (deltaTime) {
    print("Update: " + deltaTime);
});
warningMessage( message, scriptName )
Returns: Signal

Triggered when the script generates a warning or console.warn is called.

Parameters

Name Type Description
message string

The warning message.

scriptName string

The name of the script that generated the warning message.