aardio 文档

aardio 范例: ANSI 终端

//ANSI 终端
import win.ui;
/*DSG{{*/
var winform = win.form(text="ANSI 终端";right=759;bottom=469)
winform.add()
/*}}*/

import web.sciter;
var sciter = web.sciter(winform);

sciter.html = /**
<html>
    <head>
        <title>Test</title>
        <style></style>
        <script>

        const terminalView = document.$("terminal").terminal;
        writeTerminal = function(str){
            terminalView.write(str);
        }


        writeTerminal("hello world!");
        writeTerminal("\r\nAgain hello world!");

        writeTerminal("\x1B[1;31m This is red text \x1B[0m"); 

        </script>
    </head>
    <body>

     <terminal rows="24" columns="80" />

    </body>
</html>

**/

/*
调用 JavaScript 函数写入 ANSI 转义序列。
aardio 中 '\e' 等价于 '\x1B'。
*/
sciter.script.writeTerminal('\e[42mHello\e[0m')

winform.show();
win.loopMessage();
Markdown 格式