2024-07-28 02:37:31 -04:00
|
|
|
module.exports = {
|
2024-08-12 05:13:32 -04:00
|
|
|
load: (b) => {
|
2024-07-28 02:37:31 -04:00
|
|
|
b.cloops = []
|
|
|
|
b.addCloop = function (command, rate) {
|
|
|
|
b.cloops.push({
|
|
|
|
command,
|
|
|
|
rate,
|
|
|
|
interval: setInterval(() => { b.ccq.push(command) }, rate)
|
|
|
|
})
|
|
|
|
b.ccq.push(command)
|
2024-07-27 02:39:18 -04:00
|
|
|
}
|
2024-07-28 02:37:31 -04:00
|
|
|
b.removeCloop = function (index) {
|
|
|
|
clearInterval(b.cloops[index].interval)
|
|
|
|
b.cloops.splice(index, 1)
|
|
|
|
}
|
|
|
|
b.clearCloops = function () {
|
2024-08-22 07:34:39 -04:00
|
|
|
for (const cloop of b.cloops) {
|
|
|
|
clearInterval(cloop.interval)
|
2024-07-28 02:37:31 -04:00
|
|
|
}
|
|
|
|
b.cloops = []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|