X-Git-Url: https://git.r.bdr.sh/rbdr/tomato-sauce/blobdiff_plain/a140f3add912ef4bd659c1c1e82184643be7d845..a0666be3ab58ed83ad6d622cfe2b8293c40dffbb:/README.md?ds=inline diff --git a/README.md b/README.md index 87f1ae5..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,16 +65,19 @@ 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); }); tomatoSauce.run(); +``` ### Configuration Values @@ -85,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/