Skip to content

Commit

Permalink
Execute prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis committed Jan 2, 2025
1 parent 6fbeb83 commit 335719b
Show file tree
Hide file tree
Showing 179 changed files with 20,818 additions and 18,937 deletions.
37 changes: 14 additions & 23 deletions src/components/EscDshotDirection/EscDshotCommandQueue.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,49 @@
import MSP from '../../js/msp.js';
import MSP from "../../js/msp.js";

class EscDshotCommandQueue
{
constructor (intervalMs)
{
class EscDshotCommandQueue {
constructor(intervalMs) {
this._intervalId = null;
this._interval = intervalMs;
this._queue = [];
this._purging = false;
}

pushCommand(command, buffer)
{
pushCommand(command, buffer) {
this._queue.push([command, buffer]);
}

pushPause(milliseconds)
{
pushPause(milliseconds) {
const counter = Math.ceil(milliseconds / this._interval);

for (let i = 0; i < counter; i++) {
this.pushCommand(null, null);
}
}

start()
{
start() {
if (null === this._intervalId) {
this._intervalId = setInterval(
() => { this._checkQueue(); },
this._interval);
this._intervalId = setInterval(() => {
this._checkQueue();
}, this._interval);
}
}

stop()
{
if(null !== this._intervalId) {
stop() {
if (null !== this._intervalId) {
clearInterval(this._intervalId);
this._intervalId = null;
}
}

stopWhenEmpty()
{
stopWhenEmpty() {
this._purging = true;
}

clear()
{
clear() {
this._queue = [];
}

_checkQueue()
{
_checkQueue() {
if (0 !== this._queue.length) {
const command = this._queue.shift();

Expand Down
Loading

0 comments on commit 335719b

Please sign in to comment.