From 297387b2b4913d5bc41103d43c2d5ccb197a6bb2 Mon Sep 17 00:00:00 2001 From: Xmader Date: Tue, 24 Nov 2020 04:38:47 -0500 Subject: [PATCH] fix: mscoreWindow --- src/btn.ts | 5 +++-- src/main.ts | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/btn.ts b/src/btn.ts index e6ea40b..db59be3 100644 --- a/src/btn.ts +++ b/src/btn.ts @@ -1,4 +1,5 @@ +import { ScoreInfo } from './scoreinfo' import { loadMscore, WebMscore } from './mscore' import { useTimeout, windowOpen, console, _Element } from './utils' import i18n from './i18n' @@ -192,7 +193,7 @@ export namespace BtnAction { }, fallback, timeout) } - export const mscoreWindow = (fn: (w: Window, score: WebMscore, processingTextEl: ChildNode) => any): BtnAction => { + export const mscoreWindow = (scoreinfo: ScoreInfo, fn: (w: Window, score: WebMscore, processingTextEl: ChildNode) => any): BtnAction => { return async (btnName, btn, setText) => { const _onclick = btn.onclick btn.onclick = null @@ -217,7 +218,7 @@ export namespace BtnAction { btn.onclick = _onclick }) - score = await loadMscore(w) + score = await loadMscore(scoreinfo, w) fn(w, score, txt) } diff --git a/src/main.ts b/src/main.ts index 0c7935a..0f385bc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -32,7 +32,7 @@ const main = (): void => { btnList.add({ name: i18n('DOWNLOAD')('MusicXML'), - action: BtnAction.mscoreWindow(async (w, score) => { + action: BtnAction.mscoreWindow(scoreinfo, async (w, score) => { const mxl = await score.saveMxl() const data = new Blob([mxl]) saveAs(data, `${fileName}.mxl`) @@ -53,7 +53,7 @@ const main = (): void => { indvPartBtn = btnList.add({ name: i18n('IND_PARTS')(), tooltip: i18n('IND_PARTS_TOOLTIP')(), - action: BtnAction.mscoreWindow(async (w, score, txt) => { + action: BtnAction.mscoreWindow(scoreinfo, async (w, score, txt) => { const metadata = await score.metadata() console.log('score metadata loaded by webmscore', metadata)