2024-07-28 16:30:19 -04:00
|
|
|
module.exports = {
|
2024-07-29 01:35:26 -04:00
|
|
|
load: (b) => {
|
2024-07-28 16:30:19 -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)
|
|
|
|
}
|
|
|
|
b.removeCloop = function (index) {
|
|
|
|
clearInterval(b.cloops[index].interval)
|
|
|
|
b.cloops.splice(index, 1)
|
|
|
|
}
|
|
|
|
b.clearCloops = function () {
|
|
|
|
for (const i in b.cloops) {
|
|
|
|
clearInterval(b.cloops[i].interval)
|
|
|
|
}
|
|
|
|
b.cloops = []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|