less warnings when building

This commit is contained in:
2023-08-06 10:31:47 +02:00
parent b57bec7919
commit b7d38af0d3
4 changed files with 9 additions and 10 deletions

View File

@ -33,7 +33,7 @@ export class Clock {
*/ */
ctx: AudioContext ctx: AudioContext
transportNode: TransportNode transportNode: TransportNode | null
bpm: number bpm: number
time_signature: number[] time_signature: number[]
time_position: TimePosition time_position: TimePosition
@ -41,6 +41,7 @@ export class Clock {
tick: number tick: number
constructor(public app: Editor, ctx: AudioContext) { constructor(public app: Editor, ctx: AudioContext) {
this.transportNode = null;
this.ctx = ctx; this.ctx = ctx;
this.tick = 0; this.tick = 0;
this.time_position = { bar: 0, beat: 0, pulse: 0 } this.time_position = { bar: 0, beat: 0, pulse: 0 }
@ -83,6 +84,7 @@ export class Clock {
/** /**
* Starts the TransportNode (starts the clock). * Starts the TransportNode (starts the clock).
*/ */
// @ts-ignore
if (this.transportNode?.state === 'running') { if (this.transportNode?.state === 'running') {
console.log('Already started') console.log('Already started')
} else { } else {

View File

@ -41,7 +41,7 @@ export const tryEvaluate = async (
timeout = 5000 timeout = 5000
): Promise<void> => { ): Promise<void> => {
try { try {
code.evaluations++; code.evaluations!++;
const isCodeValid = await Promise.race([tryCatchWrapper( const isCodeValid = await Promise.race([tryCatchWrapper(
application, application,
`let i = ${code.evaluations};` + code.candidate, `let i = ${code.evaluations};` + code.candidate,

View File

@ -1,6 +1,6 @@
import { evaluate, tryEvaluate, evaluateCommand } from "./Evaluator"; import { tryEvaluate } from "./Evaluator";
import { Editor } from './main'; import { Editor } from './main';
const zeroPad = (num, places) => String(num).padStart(places, '0') const zeroPad = (num: number, places: any) => String(num).padStart(places, '0')
export class TransportNode extends AudioWorkletNode { export class TransportNode extends AudioWorkletNode {
@ -16,7 +16,6 @@ export class TransportNode extends AudioWorkletNode {
elapsedTime: number|undefined elapsedTime: number|undefined
prevCurrentTime: number prevCurrentTime: number
constructor(context: BaseAudioContext, options: AudioWorkletNodeOptions, application: Editor) { constructor(context: BaseAudioContext, options: AudioWorkletNodeOptions, application: Editor) {
super(context, "transport", options); super(context, "transport", options);
this.app = application this.app = application
@ -42,14 +41,11 @@ export class TransportNode extends AudioWorkletNode {
/** @type {(this: MessagePort, ev: MessageEvent<any>) => any} */ /** @type {(this: MessagePort, ev: MessageEvent<any>) => any} */
handleMessage = (message: MessageEvent) => { handleMessage = (message: MessageEvent) => {
if (message.data && message.data.type === "ping") { if (message.data && message.data.type === "bang") {
const delay = performance.now() - message.data.t;
// console.log(delay);
} else if (message.data && message.data.type === "bang") {
if (this.startTime === undefined) { if (this.startTime === undefined) {
this.startTime = message.data.currentTime; this.startTime = message.data.currentTime;
} }
this.elapsedTime = message.data.currentTime - this.startTime; this.elapsedTime = message.data.currentTime - this.startTime!;
this.prevCurrentTime = message.data.currentTime; this.prevCurrentTime = message.data.currentTime;
let { futureTimeStamp, timeToNextPulse, nextPulsePosition } = this.convertTimeToNextBarsBeats(this.elapsedTime); let { futureTimeStamp, timeToNextPulse, nextPulsePosition } = this.convertTimeToNextBarsBeats(this.elapsedTime);

View File

@ -726,6 +726,7 @@ window.addEventListener('mousemove', reportMouseCoordinates);
// When the user leaves the page, all the universes should be saved in the localStorage // When the user leaves the page, all the universes should be saved in the localStorage
window.addEventListener("beforeunload", () => { window.addEventListener("beforeunload", () => {
// @ts-ignore
event.preventDefault(); event.preventDefault();
// Iterate over all local files and set the candidate to the committed // Iterate over all local files and set the candidate to the committed
app.currentFile().candidate = app.view.state.doc.toString(); app.currentFile().candidate = app.view.state.doc.toString();