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

View File

@ -41,7 +41,7 @@ export const tryEvaluate = async (
timeout = 5000
): Promise<void> => {
try {
code.evaluations++;
code.evaluations!++;
const isCodeValid = await Promise.race([tryCatchWrapper(
application,
`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';
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 {
@ -16,7 +16,6 @@ export class TransportNode extends AudioWorkletNode {
elapsedTime: number|undefined
prevCurrentTime: number
constructor(context: BaseAudioContext, options: AudioWorkletNodeOptions, application: Editor) {
super(context, "transport", options);
this.app = application
@ -42,14 +41,11 @@ export class TransportNode extends AudioWorkletNode {
/** @type {(this: MessagePort, ev: MessageEvent<any>) => any} */
handleMessage = (message: MessageEvent) => {
if (message.data && message.data.type === "ping") {
const delay = performance.now() - message.data.t;
// console.log(delay);
} else if (message.data && message.data.type === "bang") {
if (message.data && message.data.type === "bang") {
if (this.startTime === undefined) {
this.startTime = message.data.currentTime;
}
this.elapsedTime = message.data.currentTime - this.startTime;
this.elapsedTime = message.data.currentTime - this.startTime!;
this.prevCurrentTime = message.data.currentTime;
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
window.addEventListener("beforeunload", () => {
// @ts-ignore
event.preventDefault();
// Iterate over all local files and set the candidate to the committed
app.currentFile().candidate = app.view.state.doc.toString();