TrafficLight

trafficLight. TrafficLight

A Traffic Light with red, yellow and green lights.

Constructor

new TrafficLight(redopt, yellowopt, greenopt)

Source:
Parameters:
Name Type Attributes Description
red trafficLight.Light <optional>

Red light.

yellow trafficLight.Light <optional>

Yellow light.

green trafficLight.Light <optional>

Green light.

Extends

  • EventEmitter

Members

green :trafficLight.Light

Source:

The green light.

Type:

isAvailable :boolean

Source:

If the traffic light is available: enabled and not checked-out.

Type:
  • boolean

isCheckedOut :boolean

Source:

If the traffic light is checked-out or reserved.

Type:
  • boolean

isEnabled :boolean

Source:

If the traffic light is enabled and ready to use.

Type:
  • boolean

red :trafficLight.Light

Source:

The red light.

Type:

yellow :trafficLight.Light

Source:

The yellow light.

Type:

Methods

checkIn()

Source:

Checks-in the traffic light, making it available for checking out again.

checkOut() → {boolean}

Source:

Checks-out or reserve the traffic light for exclusive usage, making it unavailable for other users.

Returns:

True if the traffic light was successfully checked out. False if it was already checked out.

Type
boolean

reset()

Source:

Sets all lights to off.

Events

disabled

Source:

Traffic light disabled event.

enabled

Source:

Traffic light enabled event.