Skip to main content

DigitalActor

Base class for digital output components (on/off control, blink, toggle).

#Extends

#Extended by

#Constructors

#Constructor

TypeScript
new DigitalActor(options): DigitalActor;

#Parameters

ParameterType
optionsDigitalActorOptions

#Returns

DigitalActor

#Overrides

ComponentBase.constructor

#Accessors

#isAnimating

#Get Signature

TypeScript
get isAnimating(): boolean;

Check if an animation is running

#Returns

boolean


#isOn

#Get Signature

TypeScript
get isOn(): boolean;

Check if the component is currently on

#Returns

boolean


#value

#Get Signature

TypeScript
get value(): T | undefined;

Get the current value of the component.

#Returns

T | undefined

#Inherited from

ComponentBase.value

#Methods

TypeScript
blink(interval?): this;

Blink the component at a given interval (Arduino-side animation)

#Parameters

ParameterTypeDefault valueDescription
intervalnumber500Blink interval in milliseconds (default: 500)

#Returns

this


#cleanup()

TypeScript
cleanup(): void;

Cleanup resources when board closes. Override in subclasses to add component-specific cleanup.

#Returns

void

#Overrides

ComponentBase.cleanup


#handleData()

TypeScript
handleData(data): void;

Handle incoming data from Arduino via serial protocol. Called by Board when data arrives for this component's ID.

#Parameters

ParameterType
dataunknown

#Returns

void

#Overrides

ComponentBase.handleData


#off()

TypeScript
off(): this;

Turn the component off

#Returns

this

#Overrides

ComponentBase.off


#on()

#Call Signature

TypeScript
on(): this;

Turn the component on (no arguments) or register an event listener.

#Returns

this

#Overrides

ComponentBase.on

#Call Signature

TypeScript
on(event, listener): this;

Turn the component on (no arguments) or register an event listener.

#Parameters
ParameterType
event"change"
listener(value) => void
#Returns

this

#Overrides

ComponentBase.on


#once()

#Call Signature

TypeScript
once<K>(event, listener): this;

Register a one-time event listener with typed events.

#Type Parameters
Type Parameter
K extends keyof ComponentEventMap<number>
#Parameters
ParameterType
eventK
listenerComponentEventMap<number>[K]
#Returns

this

#Inherited from

ComponentBase.once

#Call Signature

TypeScript
once(event, listener): this;

Register a one-time event listener with typed events.

#Parameters
ParameterType
eventstring | symbol
listener(...args) => void
#Returns

this

#Inherited from

ComponentBase.once


#removeAllListeners()

#Call Signature

TypeScript
removeAllListeners<K>(event?): this;

Remove all listeners for a specific event, or all events if no event specified.

#Type Parameters
Type Parameter
K extends keyof ComponentEventMap<number>
#Parameters
ParameterType
event?K
#Returns

this

#Inherited from

ComponentBase.removeAllListeners

#Call Signature

TypeScript
removeAllListeners(event?): this;

Remove all listeners for a specific event, or all events if no event specified.

#Parameters
ParameterType
event?string | symbol
#Returns

this

#Inherited from

ComponentBase.removeAllListeners


#removeListener()

#Call Signature

TypeScript
removeListener<K>(event, listener): this;

Remove an event listener with typed events.

#Type Parameters
Type Parameter
K extends keyof ComponentEventMap<number>
#Parameters
ParameterType
eventK
listenerComponentEventMap<number>[K]
#Returns

this

#Inherited from

ComponentBase.removeListener

#Call Signature

TypeScript
removeListener(event, listener): this;

Remove an event listener with typed events.

#Parameters
ParameterType
eventstring | symbol
listener(...args) => void
#Returns

this

#Inherited from

ComponentBase.removeListener


#set()

TypeScript
set(value): this;

Set the value of the component

#Parameters

ParameterTypeDescription
value0 | 10 (off) or 1 (on)

#Returns

this


#setBoard()

TypeScript
setBoard(board): void;

#Parameters

ParameterType
boardBoard

#Returns

void

#Inherited from

ComponentBase.setBoard


#stop()

TypeScript
stop(): this;

Stop any running animation (blink, pulse)

#Returns

this


#toggle()

TypeScript
toggle(): this;

Toggle the component state

#Returns

this


#updateOptions()

TypeScript
updateOptions(options): void;

#Parameters

ParameterType
options{ invert?: boolean; }
options.invert?boolean

#Returns

void