This commit is contained in:
2021-08-22 12:05:54 +02:00
parent fdfad0b900
commit b1e65acda6
12 changed files with 1548 additions and 36 deletions

20
src/Store.ts Normal file
View File

@@ -0,0 +1,20 @@
import type BeatUnit from "./BeatUnit";
import Beat, {BeatInitOptions} from "./Beat";
export default class Store {
private beat: Beat;
constructor(options: BeatInitOptions) {
this.beat = new Beat(options);
}
getBeat() {
return this.beat;
}
subscribeBeatUnit(schemaKey: string, index: number, callback: (unit: BeatUnit) => void): BeatUnit {
this.beat.onUnitUpdate(() => {
callback(this.beat.getUnit(schemaKey, index));
});
return this.beat.getUnit(schemaKey, index);
}
}