Files
xterm.js/test/index.html
T
2013-08-11 05:30:04 -05:00

63 lines
1.2 KiB
HTML

<!doctype html>
<title>term.js test</title>
<style>
h1 {
margin-bottom: 20px;
font: 20px/1.5 sans-serif;
}
.terminal {
float: left;
border: #000 solid 5px;
font-family: "DejaVu Sans Mono", "Liberation Mono", monospace;
font-size: 11px;
color: #f0f0f0;
background: #000;
}
.terminal-cursor {
color: #000;
background: #f0f0f0;
}
</style>
<h1>term.js test</h1>
<script src="term.js"></script>
<script src="data.js"></script>
<script>
;(function() {
var time = new Date
, l = data.length * 0.9 | 0
, i = 0;
Terminal.cursorBlink = false;
var term = new Terminal({
cols: 80,
rows: 30
});
window.onload = function() {
// Add terminal.
term.open(document.body);
// Run benchmark.
(function write() {
if (i >= l) return next();
term.write(data[i]);
i++;
setTimeout(write, 1);
})();
// Results.
function next() {
term.write('\x1b[2J');
term.reset();
term.refresh(0, term.rows - 1);
term.writeln('Completed in ' + (new Date - time) + '.');
term.writeln('Writes: ' + l + '.');
term.writeln('Average (?): 28.5k (for ~2.5k writes).');
}
};
}).call(this);
</script>