Monitos.IO
An extension of Monitos where all events are emitted to Socket.IO.
Example:
Monito; // Socket.IO server on port 9183 let chimp = initialState: 'register' states: { ; // Go straight to the state "getProfile" } { ; // Otherwise, by default, go to "shop" } { ; } { ; // Go straight to the state "logout" } { ; // This will be the last state } ; chimpstart;
See the full code of the example.
Usage
Monito.openSocket(9183);
let chimp = new Monito(states, initialState);
chimp.on('end', () => {
Monito.closeSocket()
});
Static methods
Monito.openSocket(arguments)
- Initializes Socket.IO. For a full list of options, check the Socket.IO documentation.Monito.closeSocket()
- Closes Socket.IO socket.Monito.getSocket()
- Returns the Socket.IO socket.
Arguments
There are no new constructor arguments. For a full list of arguments, check the Monitos documentation.
Events
There are no new events. For a full list of events, check the Monitos documentation.
API
There are no new API methods. For a full list, check the Monitos documentation.
Testing
Run all the tests (linting and unit tests) with the following npm task:
> npm test
You can run the linting and the unit tests individually:
> gulp test
> gulp lint