deal with bad csr's. improve example. readme.

This commit is contained in:
Christopher Jeffrey
2013-08-10 15:39:28 -05:00
parent 49d3a20f3c
commit 628af0532f
4 changed files with 77 additions and 44 deletions
+19 -10
View File
@@ -1,7 +1,7 @@
<!doctype html>
<title>tty.js</title>
<title>term.js</title>
<!--
tty.js
term.js
Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
-->
<style>
@@ -19,21 +19,24 @@
background: #000;
}
.reverse-video {
.terminal-cursor {
color: #000;
background: #f0f0f0;
}
</style>
<h1>tty.js</h1>
<h1>term.js</h1>
<script src="/socket.io/socket.io.js"></script>
<script src="term.js"></script>
<script>
;(function() {
return setTimeout(function() {
var term = new Terminal(80, 24)
, socket = io.connect();
window.onload = function() {
var socket = io.connect();
socket.on('connect', function() {
var term = new Terminal({
cols: 80,
rows: 24
});
term.on('data', function(data) {
socket.emit('data', data);
});
@@ -42,12 +45,18 @@
document.title = title;
});
term.open();
term.open(document.body);
term.write('\x1b[31mWelcome to term.js!\x1b[m\r\n');
socket.on('data', function(data) {
term.write(data);
});
socket.on('disconnect', function() {
term.destroy();
});
});
}, 1000);
};
}).call(this);
</script>