AWin/aardiowin/main.aardio
2024-08-20 15:40:27 +08:00

56 lines
1.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import win.ui;
import init;
// 初始化
init.init();
var gConfig = init.loadConfigs();
var gDebug = init.getDebug();
// 启动界面
/*DSG{{*/
mainForm = win.form(text="awin";right=1;bottom=1;border="thin";max=false;min=false)
mainForm.add()
/*}}*/
// 日志
var gLog = init.getLog();
gLog.print("width=" , gConfig.window.width)
gLog.print("height=" , gConfig.window.height)
mainForm.resize(gConfig.window.width, gConfig.window.height);
import web.view;
var theView = web.view(mainForm);
//导出为 JavaScript 中的 aardio 对象
theView.external = {
onCounterUpdate = function(name,value){
if(name!==null && value!==null){
return "aardio 返回的值:网页中 React 状态值改变了value:"+value;
}
};
}
import wsock.tcp.simpleHttpServer;
/*
如果导入 simpleHttpServer则单个斜杠开头的路径会转换为嵌入式 HTTP 地址,
如果同时文件名为 index.html ,则上级目录自动设为根目录,前端应用发布根目录使用默认的 "/" 即可,不需要改动。
去掉下面的前端项目调试端口号 37151 或发布 EXE 后运行才会打开 "\web\index.html"。
否则打开 http://localhost:37151
*/
if( gDebug ){
theView.go("\web\index.html",37151);
} else {
theView.go("\web\index.html");
}
mainForm.show();
win.loopMessage();