up
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<!doctype html>
|
||||
<title>tty.js test</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<style>
|
||||
body > div { float: left; }
|
||||
h1 { margin-bottom: 20px; }
|
||||
</style>
|
||||
<h1>tty.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(80, 30);
|
||||
|
||||
setTimeout(function() {
|
||||
// Add terminal.
|
||||
term.open();
|
||||
|
||||
// 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).');
|
||||
}
|
||||
}, 500);
|
||||
}).call(this);
|
||||
</script>
|
||||
Reference in New Issue
Block a user