fix: mscoreWindow

This commit is contained in:
Xmader 2020-11-24 04:38:47 -05:00
parent 3b43957cee
commit 297387b2b4
No known key found for this signature in database
GPG Key ID: A20B97FB9EB730E4
2 changed files with 5 additions and 4 deletions

View File

@ -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)
}

View File

@ -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)