@stringsync/vexml
Version:
MusicXML to Vexflow
33 lines (32 loc) • 828 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Beam = void 0;
class Beam {
config;
log;
phase;
constructor(config, log, phase) {
this.config = config;
this.log = log;
this.phase = phase;
}
static create(config, log, musicXML) {
let phase;
switch (musicXML.beam.getBeamValue()) {
case 'begin':
phase = 'start';
break;
default:
phase = 'continue';
break;
}
return new Beam(config, log, phase);
}
parse(voiceEntryCtx) {
if (this.phase === 'start') {
return voiceEntryCtx.beginBeam();
}
return voiceEntryCtx.continueBeam() ?? voiceEntryCtx.beginBeam();
}
}
exports.Beam = Beam;