X-Git-Url: https://git.r.bdr.sh/rbdr/tomato-sauce/blobdiff_plain/be12c97f83026087e0974fc54508b09c3154c9eb..36ff43dc094c3058bd26546454bb7a6776c685d3:/README.md?ds=sidebyside diff --git a/README.md b/README.md index 99ae4fb..6671109 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,12 @@ -# tomato-sauce +## Tomato Sauce + Draw stuff via telnet ## How to run -`npm install` and then run ``./bin/server.js`. It will listen on port 9999 +You will need [Node.js][node] installed, at least version 8. Install +dependencies by running `npm install` from the root of the project +and start the server by running `npm start`. It will listen on port 9999 by default. ## Configuration variables @@ -27,8 +30,8 @@ the width of the viewport, the height of the viewport, and a renderer function, and it returns a string that consists of the commands that will be sent to the socket. - * `TomatoSauce.IScreen(modulation , width , height , renderer - ) -> payload ` + * `IScreen(modulation , width , height , renderer + ) -> payload ` It should output the required commands that telnet needs to move the cursor and draw. For convenience, a renderer function is passed so @@ -46,7 +49,7 @@ You can build your own renderer by building a function that receives a red, green, and blue component from 0 to 255 and returns the escape codes to generate the color. - * `TomatoSauce.IRenderer(red , green , blue ) -> + * `IRenderer(red , green , blue ) -> colorString ` ## Using as a library @@ -62,12 +65,14 @@ const TomatoSauce = require('tomato-sauce'); const tomatoSauce = new TomatoSauce(config); -tomatoSauce.on('listening', function () { +tomatoSauce.on('listening', () => { + const address = event.data.server.address(); console.log(`Tomato Sauce listening on: ${address.address}:${address.port}`); }); -tomatoSauce.on('error', function (error) { +tomatoSauce.on('error', (error) => { + console.error(error); }); @@ -86,4 +91,5 @@ optional.) (Defaults to 5) * `screens`: An array containing the screen functions (Defaults to []) * `renderers`: An array containing the renderer functions (Defaults to []) -``` + +[node]: https://nodejs.org/en/