1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-25 08:48:06 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-12-05 21:56:42 +08:00
parent b6dc209117
commit 655b11ac77
2 changed files with 5 additions and 1 deletions

View File

@ -118,6 +118,7 @@ Volcanos("core", {
})(k) } } return list
},
Timer: shy("定时器, value, [1,2,3,4], {delay, interval, length}", function(interval, cb, cbs) { var timer = {stop: false}
if (interval == "0") { return cb && cb(), cbs && cbs() }
function loop(i) { timer.stop || i >= interval.length && interval.length >= 0 || cb(timer, interval.interval||interval[i], i, interval)?
typeof cbs == code.FUNCTION && cbs(timer, interval): setTimeout(function() { loop(i+1) }, interval.interval||interval[i+1])
} interval = typeof interval == code.OBJECT? interval: [interval]; if (interval.interval == 0) { return cb(), timer }

View File

@ -35,7 +35,10 @@ Volcanos(chat.ONIMPORT, {
if (msg.Option(ctx.DISPLAY)) {
function _grow() { if (can.sub._grow_list.length == 0) { return } if (can.sub._grow_running) { return } can.sub._grow_running = true
var msg = can.sub._grow_list.shift(), list = [], text = msg.detail[1]; for (var i = 0; i < text.length; i++) { list.push(text[i]) }
can.core.Next(list, function(text, next) { can.core.Timer(30, next), can.sub._grow.onimport.grow(can.sub._grow, msg, "only", text) }, function() { can.sub._grow_running = false, _grow() })
can.core.Next(list, function(text, next) {
can.sub._grow.onimport.grow(can.sub._grow, msg, "only", text)
can.core.Timer(msg.Option("delay")||30, next)
}, function() { can.sub._grow_running = false, _grow() })
}
if (can.sub._grow) {
(can.sub._grow_list = can.sub._grow_list||[]).push(msg); return _grow()