Renamed root level note() to midi(). midi() & sound() now accepts object as parameter

This commit is contained in:
2023-08-24 10:50:17 +03:00
parent 8da1aa7ac2
commit a421a28844
8 changed files with 66 additions and 69 deletions

37
src/classes/RestEvent.ts Normal file
View File

@@ -0,0 +1,37 @@
import { type Editor } from '../main';
import { Event } from "./AbstractEvents";
export class RestEvent extends Event {
constructor(duration: number, app: Editor) {
super(app);
this.values["duration"] = duration;
}
_fallbackMethod = (): Event => {
return this;
}
public static createRestProxy = (duration: number, app: Editor) => {
const instance = new RestEvent(duration, app);
return new Proxy(instance, {
// @ts-ignore
get(target, propKey, receiver) {
// @ts-ignore
if (typeof target[propKey] === 'undefined') {
return target._fallbackMethod;
}
// @ts-ignore
return target[propKey];
},
// @ts-ignore
set(target, propKey, value, receiver) {
return false;
}
});
}
out = (): void => {
// TODO?
}
}