control-rod-assembly
Stability: 1 - Experimental
Control structure for connecting and disconnecting multiple ControlRods at once.
Usage
var ControlRod = ControlRodAssembly = events = ; var storage = ;var publicserver = ;var peerServer = ; var rod1 = storage 'foo' { /* ... */ };var rod2 = storage 'bar' { /* ... */ };var rod3 = publicserver 'foo' { /* ... */ };var rod4 = publicserver 'bar' { /* ... */ };var rod5 = peerServer 'foo' { /* ... */ };var rod6 = peerServer 'bar' { /* ... */ };var rod7 = peerServer 'baz' { /* ... */ }; var rodAssembly = rod1 rod2 rod3 rod4 rod5;rodAssembly; rodAssembly;rodAssembly; rodAssembly;// all rods are connectedrodAssembly;// all rods are disconnected rodAssembly;// [rod1, rod2, rod3, rod4, rod5, rod6, rod7] array of rods in assembly
Test
npm test
Overview
ControlRodAssembly is an abstraction over a collection of ControlRods in order to connect and disconnect them together.
Documentation
ControlRodAssembly
Public API
- new ControlRodAssembly(rod, [rod, ...])
- controlRodAssembly.add(rod, [rod, ...])
- controlRodAssembly.connect()
- controlRodAssembly.disconnect()
- controlRodAssembly.remove(rod, [rod, ...])
- controlRodAssembly.rods()
- Event 'connected'
- Event 'disconnected'
new ControlRodAssembly(rod, [rod, ...])
rod, [rod, ...]
: ControlRod Zero, one, or more control rods to initialize with.
Creates a new instance of ControlRodAssembly.
controlRodAssembly.add(rod, [rod, ...])
rod, [rod, ...]
: ControlRod Zero, one, or more control rods to add.
Adds specified ControlRods to assembly.
controlRodAssembly.connect()
Connects all ControlRods in the assembly.
controlRodAssembly.disconnect()
Disconnects all ControlRods in the assembly.
controlRodAssembly.remove(rod, [rod, ...])
rod, [rod, ...]
: ControlRod Zero, one, or more control rods to remove.
Removes specified ControlRods from assembly.
controlRodAssembly.rods()
- Return: Array An array of
ControlRod
s in this assembly.
connected
Event function () {}
Emitted once all the control rods in the assembly are connected.
disconnected
Event function () {}
Emitted once all the control rods in the assembly are disconnected.