Change: report updatable after the install button is prepared
This commit is contained in:
parent
a194f7eb26
commit
8cec0e7a65
|
@ -93,9 +93,26 @@
|
|||
});
|
||||
}
|
||||
|
||||
function prepareInstallButton() {
|
||||
return new Promise(resolve => {
|
||||
const observer = new MutationObserver(check);
|
||||
observer.observe(document.documentElement, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
check();
|
||||
|
||||
function check() {
|
||||
if (document.querySelector('#install_style_button')) {
|
||||
resolve();
|
||||
observer.disconnect();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function reportUpdatable(isUpdatable) {
|
||||
// USO doesn't bind these listeners immediately
|
||||
setTimeout(() => {
|
||||
prepareInstallButton().then(() => {
|
||||
sendEvent({
|
||||
type: isUpdatable
|
||||
? 'styleCanBeUpdatedChrome'
|
||||
|
@ -104,7 +121,7 @@
|
|||
updateUrl: installedStyle.updateUrl
|
||||
},
|
||||
});
|
||||
}, 300);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user