UNPKG

@thi.ng/axidraw

Version:

Minimal AxiDraw plotter/drawing machine controller for Node.js

31 lines (30 loc) 580 B
import { AxiDrawState } from "./api.js"; class AxiDrawControl { constructor(interval = 1e3) { this.interval = interval; } state = AxiDrawState.CONTINUE; deref() { return this.state; } reset() { this.state = AxiDrawState.CONTINUE; return this; } pause() { if (this.state === AxiDrawState.CONTINUE) { this.state = AxiDrawState.PAUSE; } } resume() { if (this.state === AxiDrawState.PAUSE) { this.state = AxiDrawState.CONTINUE; } } cancel() { this.state = AxiDrawState.CANCEL; } } export { AxiDrawControl };