upgrade-dev v2.3.5

This commit is contained in:
杨红岩 2023-03-14 23:37:22 +08:00
parent fe1e2be41d
commit 720907a549
2 changed files with 27 additions and 3 deletions

View File

@ -8,6 +8,7 @@ import (
"github.com/energye/energy/example/dev-test/ipc-event/src"
"github.com/energye/energy/ipc"
"github.com/energye/golcl/lcl"
"time"
//_ "net/http/pprof"
)
@ -75,10 +76,20 @@ func main() {
r10[0] = r9
r10[1] = r9
r10[2] = r9
var tm = time.Now().Second()
var cha = 0
ipc.On("testGoEmit", func(context ipc.IContext) {
count++
fmt.Println("testGoEmit", context.BrowserId(), context.FrameId())
args := context.ArgumentList().JSONArray()
if tm > 58 {
tm = time.Now().Second()
}
if time.Now().Second() >= tm+1 {
cha = args.GetIntByIndex(0) - cha
fmt.Println("testGoEmit", args.GetIntByIndex(0), cha)
cha = args.GetIntByIndex(0)
tm = time.Now().Second()
}
//触发JS监听的函数并传入参数
ipc.Emit("onTestName1", r0, r1+count, r2, r3, r4, r5, r6, r7, r8, r9, r10)
//ipc.EmitAndCallback("", func() {}, "aaaa")

View File

@ -145,13 +145,26 @@
if (tgesi != null) {
clearInterval(tgesi)
tgesi = null
idx = 0;
return
}
tgesi = setInterval(testGoEmit, 1)
if (tgesi != null) {
let time = document.getElementById("time").value - 0
if (time > 0) {
setTimeout(function () {
clearInterval(tgesi)
msg(idx)
tgesi = null
idx = 0;
}, time)
}
}
}
function testGoEmit() {
ipc.emit("testGoEmit");
idx++
ipc.emit("testGoEmit", [idx]);
}
function bindFunc() {