]> git.proxmox.com Git - mirror_xterm.js.git/commitdiff
Started documenting methods
authorparis <pariskasidiaris@gmail.com>
Fri, 2 May 2014 22:51:38 +0000 (22:51 +0000)
committerparis <pariskasidiaris@gmail.com>
Fri, 2 May 2014 22:51:38 +0000 (22:51 +0000)
Also added Getting Started section in docs

docs/index.rst
docs/methods.rst [new file with mode: 0644]

index 45d5df79673939c704c99b22269b0559f3d9d8d5..8dcf8cab238f2b81d2c0bd0790e5a82286cbf2b3 100644 (file)
@@ -13,11 +13,29 @@ the experience of running a fully-feature terminal inside the browser.
 
 Xterm.js serves as the foundation for the terminal found at www.sourcelair.com.
 
-Contents:
+Getting started
+^^^^^^^^^^^^^^^
+
+.. code-block:: javascript
+    
+   var term = new Terminal(),
+       socket = new WebSocket('ws://docker/containers/mycontainer/attach/ws');
+  
+   term.open(document.body);
+   term.on('data', function (data) {
+       socket.send(data);
+   });
+   socket.onmessage = function (e) {
+       term.write(e.data);
+   }
+    
+
+Contents
 
 .. toctree::
    :maxdepth: 1
    
+   methods
    events
 
 
diff --git a/docs/methods.rst b/docs/methods.rst
new file mode 100644 (file)
index 0000000..6e89afd
--- /dev/null
@@ -0,0 +1,47 @@
+-------
+Methods
+-------
+
+focus()
+^^^^^^^
+Sends focus to the terminal
+
+blur()
+^^^^^^
+Blurs the Terminal
+
+open(element)
+^^^^
+Open the Xterm terminal, inside the given element.
+
+resize(x, y)
+^^^^^^^^^^^^
+Resize the terminal, according to the given columns and rows.
+
+insertRow(row)
+^^^^^^^^^^^^^^
+Insert the given row in the terminal.
+
+on(event, callback)
+^^^^^^^^^^^^^^^^^^^
+Hook the given callback, to the given event.
+
+off(event, callback)
+^^^^^^^^^^^^^^^^^^^
+Remove the Hook of the given callback, from the given event.
+
+once(event, callback)
+^^^^^^^^^^^^^^^^^^^
+Hook the given callback to the given event, for just a single invocation.
+
+write(data)
+^^^^^^^^^^^
+Write the given data to the terminal.
+
+writeln(data)
+^^^^^^^^^^^^^
+Write the given data to the terminal, followed by a carriage return and a new line.
+
+handler(data)
+^^^^^^^^^^^^^
+Fire the data event, for the given data.
\ No newline at end of file