Skip to content

Commit

Permalink
chore: adjust timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
usoonees committed Nov 1, 2022
1 parent 45dbdb4 commit 37c90db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "logseq-plugin-link-unlinked",
"version": "1.1.1",
"version": "1.1.2",
"main": "dist/index.html",
"logseq": {
"title": "Link Unlinked References",
Expand Down
6 changes: 4 additions & 2 deletions public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ async function main() {
}
};

const showUnlinkTimeout = 500

const obConfig = {
childList: true,
subtree: true,
Expand All @@ -70,7 +72,7 @@ async function main() {
function addObserverIfDesiredNodeAvailable() {
unlinkedRefsContainer = doc.querySelector(".page>div:nth-last-child(1) .references");
if(!unlinkedRefsContainer) {
setTimeout(addObserverIfDesiredNodeAvailable, 1000);
setTimeout(addObserverIfDesiredNodeAvailable, showUnlinkTimeout);
return;
}
unlinkObserver.observe(unlinkedRefsContainer, obConfig);
Expand All @@ -80,7 +82,7 @@ async function main() {
logseq.App.onRouteChanged(() => {
setTimeout(() => {
addObserverIfDesiredNodeAvailable();
}, 1000) // wait for page load, otherwise would observer the previous page
}, showUnlinkTimeout) // wait for page load, otherwise would observer the previous page
});

logseq.beforeunload(async () => {
Expand Down

0 comments on commit 37c90db

Please sign in to comment.