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

Description:
  • The green light.

Source:

The green light.

Type:

isAvailable :boolean

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

Source:

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

Type:
  • boolean

isCheckedOut :boolean

Description:
  • If the traffic light is checked-out or reserved.

Source:

If the traffic light is checked-out or reserved.

Type:
  • boolean

isEnabled :boolean

Description:
  • If the traffic light is enabled and ready to use.

Source:

If the traffic light is enabled and ready to use.

Type:
  • boolean

red :trafficLight.Light

Description:
  • The red light.

Source:

The red light.

Type:

yellow :trafficLight.Light

Description:
  • The yellow light.

Source:

The yellow light.

Type:

Methods

checkIn()

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

Source:

checkOut() → {boolean}

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

Source:
Returns:

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

Type
boolean

reset()

Description:
  • Sets all lights to off.

Source:

Events

disabled

Description:
  • Traffic light disabled event.

Source:

enabled

Description:
  • Traffic light enabled event.

Source: