Constructor
new MultiTrafficLight(trafficLights)
Parameters:
Name | Type | Description |
---|---|---|
trafficLights |
Array.<trafficLight.TrafficLight> | Traffic lights composed. |
Extends
Members
green :trafficLight.Light
- Source:
- Overrides:
The green light.
Type:
isAvailable :boolean
- Source:
- Overrides:
If the traffic light is available: enabled and not checked-out.
Type:
- boolean
isCheckedOut :boolean
- Source:
- Overrides:
If the traffic light is checked-out or reserved.
Type:
- boolean
isEnabled :boolean
- Source:
- Overrides:
If any of the composed traffic lights is enabled.
Type:
- boolean
red :trafficLight.Light
- Source:
- Overrides:
The red light.
Type:
yellow :trafficLight.Light
- Source:
- Overrides:
The yellow light.
Type:
Methods
checkIn()
- Source:
- Overrides:
Checks-in the traffic light, making it available for checking out again.
checkOut() → {boolean}
- Source:
- Overrides:
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:
- Overrides:
Sets all lights to off.
Events
disabled
- Source:
- Overrides:
Traffic light disabled event.
enabled
- Source:
- Overrides:
Traffic light enabled event.