Skip to content

Home > resol-vbus-core-toolbox > Script

Script class

A script.

Signature:

typescript
export declare class Script

Constructors

Constructor

Modifiers

Description

(constructor)(options)

Create a script.

Properties

Property

Modifiers

Type

Description

$

ScriptDollar<unknown>

The $ argument passed to the script's handler function.

absFilename

string

The absolute filename of the script.

eventBus

EventBus

The event bus for this script.

handler

DefineScriptHandler | null

The handler passed to the defineScript() function.

liveTransceivers

core.LiveTransceiver[]

The bridges from this script to the connections.

onConnect

(script: Script) => Promise<void>

Callback used to synchronize all $.connect calls.

onDisconnect

(script: Script) => Promise<void>

Callback used to synchronize all $.disconnect calls.

onTransmit

(script: Script, channel: number, buffer: Uint8Array) => void

Callback used to transmit data from this script using $.send.

phase

'notStarted' | 'initializing' | 'connecting' | 'connected' | 'disconnecting' | 'disconnected'

The phase of the script.

scriptInterface

ScriptInterface<unknown>

The interface returned by the defineScript() function.

scriptModule

ScriptModule | null

The module in scope while executing the script.

service

unknown | null

The service provided to registerService().

serviceRegistered

boolean

Indicates whether registerService() has been called.

serviceRegistrationStartGate

StartGate

Used to synchronize registerService() / requireService().

Methods

Method

Modifiers

Description

connect()

Signal that this script wants to connect and wait for all other scripts to do the same.

disconnect()

Signal that this script wants to disconnect and wait for all other scripts to do the same.

run(connections)

Run this script.

setHandler(handler)

Set the script's handler function.