Always set currentMd5 & add a delay before firing USO event
This commit is contained in:
parent
31d37c8832
commit
ea1c1b5100
|
@ -75,13 +75,13 @@
|
||||||
document.dispatchEvent(new CustomEvent('stylusFixBuggyUSOsettings', {
|
document.dispatchEvent(new CustomEvent('stylusFixBuggyUSOsettings', {
|
||||||
detail: installedStyle && installedStyle.updateUrl,
|
detail: installedStyle && installedStyle.updateUrl,
|
||||||
}));
|
}));
|
||||||
|
currentMd5 = md5;
|
||||||
if (!installedStyle) {
|
if (!installedStyle) {
|
||||||
sendEvent({type: 'styleCanBeInstalledChrome'});
|
sendEvent({type: 'styleCanBeInstalledChrome'});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const isCustomizable = /\?/.test(installedStyle.updateUrl);
|
const isCustomizable = /\?/.test(installedStyle.updateUrl);
|
||||||
const md5Url = getMeta('stylish-md5-url');
|
const md5Url = getMeta('stylish-md5-url');
|
||||||
currentMd5 = md5;
|
|
||||||
if (md5Url && installedStyle.md5Url && installedStyle.originalMd5) {
|
if (md5Url && installedStyle.md5Url && installedStyle.originalMd5) {
|
||||||
reportUpdatable(isCustomizable || md5 !== installedStyle.originalMd5);
|
reportUpdatable(isCustomizable || md5 !== installedStyle.originalMd5);
|
||||||
} else {
|
} else {
|
||||||
|
@ -94,6 +94,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function reportUpdatable(isUpdatable) {
|
function reportUpdatable(isUpdatable) {
|
||||||
|
// USO doesn't bind these listeners immediately
|
||||||
|
setTimeout(() => {
|
||||||
sendEvent({
|
sendEvent({
|
||||||
type: isUpdatable
|
type: isUpdatable
|
||||||
? 'styleCanBeUpdatedChrome'
|
? 'styleCanBeUpdatedChrome'
|
||||||
|
@ -102,6 +104,7 @@
|
||||||
updateUrl: installedStyle.updateUrl
|
updateUrl: installedStyle.updateUrl
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
}, 300);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user