This commit is contained in:
Jan Prochazka 2021-04-08 19:56:36 +02:00
parent 20fccf51d9
commit 153a4bca42

View File

@ -21,17 +21,19 @@ export default function createActivator(name: string, activateOnTabVisible: bool
let tabVisibleValue;
onMount(() => {
const unsubscribeTabVisible = tabVisible.subscribe(value => {
tabVisibleValue = value;
if (activateOnTabVisible) {
activate();
}
});
invalidateCommands();
if (tabVisible) {
const unsubscribeTabVisible = tabVisible.subscribe(value => {
tabVisibleValue = value;
if (activateOnTabVisible) {
activate();
}
});
invalidateCommands();
return () => {
unsubscribeTabVisible();
};
return () => {
unsubscribeTabVisible();
};
}
});
const activate = () => {