From 4ee1e00808a8846d37533bb2ecd7ce58057f9c8a Mon Sep 17 00:00:00 2001 From: Saswat Das Date: Thu, 15 Dec 2016 21:26:04 +0530 Subject: [PATCH 1/2] Update README.md Adding a getting started instruction for adding xterm to a parent div and listening for data output from xterm --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 3fd3d884..6ac33d4a 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,28 @@ npm start Then open http://0.0.0.0:3000 in a web browser (use http://127.0.0.1:3000 if running under Windows). +## Getting Started + +To attact the xterm `Terminal` to a parent div + +```html +
+``` + +```js +var term = new Terminal(); +term.open(document.getElementById('#terminal')); +term.write('Hello from \033[1;3;31mxterm.js\033[0m $ ') +``` +To get the data from xterm to send to a server or for proccessing you can + +```js +function onDataReceived(data) { + // Your logic +} +term.on('data', onDataReceived); +``` + ## Addons Addons are JavaScript modules that attach functions to the `Terminal` prototype to extend its functionality. There are a handful available in the main repository in the `dist/addons` directory, you can even write your own (though they may break when the internals of xterm.js change across versions). From d018a547a23c679ba4f0e2de24bf24718bfc5e11 Mon Sep 17 00:00:00 2001 From: Saswat Das Date: Sun, 18 Dec 2016 04:48:19 +0530 Subject: [PATCH 2/2] Update README.md Added Getting started content from the xtermjs.org website --- README.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 6ac33d4a..0c178c58 100644 --- a/README.md +++ b/README.md @@ -54,25 +54,25 @@ Then open http://0.0.0.0:3000 in a web browser (use http://127.0.0.1:3000 if run ## Getting Started -To attact the xterm `Terminal` to a parent div - +To start using xterm.js on your browser, add the `xterm.js` and `xterm.css` to the head of your html page. Then create a `
` onto which xterm can attach itself. ```html -
-``` - -```js -var term = new Terminal(); -term.open(document.getElementById('#terminal')); -term.write('Hello from \033[1;3;31mxterm.js\033[0m $ ') -``` -To get the data from xterm to send to a server or for proccessing you can - -```js -function onDataReceived(data) { - // Your logic -} -term.on('data', onDataReceived); + + + + + + + +
+ + + ``` +Finally instantiate the `Terminal` object and then call the `open` function with the DOM object of the `div`. ## Addons