1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-04-09 18:25:08 +08:00
parent 74358ff30d
commit 3fee88f2bf
2 changed files with 3 additions and 3 deletions

View File

@ -224,7 +224,7 @@ func _space_echo(m *ice.Message, source, target []string, c *websocket.Conn) {
func _space_send(m *ice.Message, name string, arg ...string) (h string) { func _space_send(m *ice.Message, name string, arg ...string) (h string) {
withecho := m.Option(ice.SPACE_NOECHO) != ice.TRUE withecho := m.Option(ice.SPACE_NOECHO) != ice.TRUE
kit.If(len(arg) > 0 && arg[0] == TOAST, func() { withecho = false; m.Option(ice.MSG_DEBUG, ice.FALSE) }) kit.If(len(arg) > 0 && arg[0] == TOAST, func() { withecho = false; m.Option(ice.MSG_DEBUG, ice.FALSE) })
wait, done := m.Wait(kit.Select("", m.OptionDefault(ice.SPACE_TIMEOUT, "180s"), withecho), func(msg *ice.Message, arg ...string) { wait, done := m.Wait(kit.Select("", m.OptionDefault(ice.SPACE_TIMEOUT, "30s"), withecho), func(msg *ice.Message, arg ...string) {
m.Cost(kit.Format("%v->[%v] %v %v", m.Optionv(ice.MSG_SOURCE), name, m.Detailv(), msg.FormatSize())).Copy(msg) m.Cost(kit.Format("%v->[%v] %v %v", m.Optionv(ice.MSG_SOURCE), name, m.Detailv(), msg.FormatSize())).Copy(msg)
}) })
if withecho { if withecho {

View File

@ -26,11 +26,11 @@ Volcanos(chat.ONACTION, {
}, function(list) { can.Status(cli.STEP, list.length), can.Status(cli.COST, can.base.Duration(new Date().getTime()-begin)), can.user.toastSuccess(can) }) }, }, function(list) { can.Status(cli.STEP, list.length), can.Status(cli.COST, can.base.Duration(new Date().getTime()-begin)), can.user.toastSuccess(can) }) },
preview: function(event, can, msg, next, data, tr) { preview: function(event, can, msg, next, data, tr) {
can.onappend.plugin(can, {space: msg.Option(web.SPACE), index: msg.Option(ctx.INDEX), style: msg.Option(ctx.STYLE)}, function(sub) { var done = false can.onappend.plugin(can, {space: msg.Option(web.SPACE), index: msg.Option(ctx.INDEX), style: msg.Option(ctx.STYLE)}, function(sub) { var done = false
function action(skip) { sub.Update(sub.request({}, {_handle: ice.TRUE}), [ctx.ACTION, msg.Option(cli.PLAY)], function(msg) { function action(skip) { sub.Update(sub.request({}, {"space.timeout": "300s",_handle: ice.TRUE}), [ctx.ACTION, msg.Option(cli.PLAY)], function(msg) {
sub.onimport._process(sub, msg) || msg.Length() == 0 && msg.Result() == "" || can.onappend._output(sub, msg), next && next(data) sub.onimport._process(sub, msg) || msg.Length() == 0 && msg.Result() == "" || can.onappend._output(sub, msg), next && next(data)
}) } }) }
if (msg.Option(ctx.STYLE) == "async") { if (msg.Option(ctx.STYLE) == "async") {
done = true, sub.Update(sub.request({}, {_handle: ice.TRUE}), [ctx.ACTION, msg.Option(cli.PLAY)]), next && next(data) done = true, sub.Update(sub.request({}, {"space.timeout": "300s", _handle: ice.TRUE}), [ctx.ACTION, msg.Option(cli.PLAY)]), next && next(data)
} else { } else {
can.onmotion.delay(can, function() { if (done || sub._auto) { return } done = true, action() }, 300) can.onmotion.delay(can, function() { if (done || sub._auto) { return } done = true, action() }, 300)
} }