mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-04-22 15:25:47 -07:00
50 lines
988 B
HTML
50 lines
988 B
HTML
<!doctype html>
|
|
<title>term.js test</title>
|
|
<style>
|
|
h1 {
|
|
margin-bottom: 20px;
|
|
font: 20px/1.5 sans-serif;
|
|
}
|
|
</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,
|
|
useStyle: true
|
|
});
|
|
|
|
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>
|