fix: buttons disappear after 1s

This commit is contained in:
Xmader 2020-11-10 09:46:35 -05:00
parent 8b274a169a
commit 3076c6cffd
No known key found for this signature in database
GPG Key ID: A20B97FB9EB730E4
1 changed files with 19 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import { loadMscore, WebMscore } from './mscore'
import { webpackGlobalOverride } from './webpack-hook'
import i18n from './i18n'
type BtnElement = HTMLButtonElement
@ -35,6 +36,24 @@ interface BtnOptions {
readonly tooltip?: string;
}
const SCORE_BTN_MODULE_ID = 'WYqd'
webpackGlobalOverride(SCORE_BTN_MODULE_ID, (_, r, t) => { // override
const fn = r.a
let firstTime = true
// the root container of btns refreshes every 1s
t.d(r, 'a', () => {
return function () {
if (!firstTime) {
// force state update
this.__H.__[0].__[0] = 0
} else {
firstTime = false
}
return fn() as void
}
})
})
export class BtnList {
private readonly list: BtnElement[] = [];