sciter 运行本机耗时函数
By
terrorist
at 2022-05-29 • 0人收藏 • 827人看过
用的是 winThreadTask 库
import win.ui; /*DSG{{*/ var winform = win.form(text="external 接口";right=1014;bottom=523) winform.add() /*}}*/ io.open() import aaz.winThreadTask; import web.sciter; import web.sciter.debug var wbSciter = web.sciter( winform ); wbSciter.attachEventHandler(web.sciter.debug) var task = aaz.winThreadTask() // 模拟耗时函数 var test = function(){ sleep(3000) return false, "出错了"; } wbSciter.external = { func = function(param, proc){ task.create( test, proc.clone() // 注意! 不克隆会报错 ) } } wbSciter.html = /** <body> <button id="my-button">调用耗时函数</button> <script> document.on("click", "#my-button", (evt, dom)=>{ dom.disabled = true external.func( "参数", function(ok,err){ dom.disabled = false dom.textContent = "执行完毕" if(!ok){ Window.post(()=>Window.this.modal(<error>{err}</error>)) } } ) }) </script> </body> **/ winform.show(); win.loopMessage();
1 个回复 | 最后更新于 2022-05-30
the100s
2022-05-30
#1
登录后方可回帖