Skip to content

Commit

Permalink
fix: kaiwu db load (#917)
Browse files Browse the repository at this point in the history
* feat: add fast-pr button position

* fix: kaiwuDB load
  • Loading branch information
wangyantong2000 authored Nov 11, 2024
1 parent 1c48b96 commit 09b7c6d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/pages/ContentScripts/features/fast-pr/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import { createRoot } from 'react-dom/client';
import features from '../../../../feature-manager';
import View from './view';
import { handleMessage } from './handleMessage';
import i18n from '../../../../helpers/i18n';
const featureId = features.getFeatureID(import.meta.url);
const t = i18n.t;
Expand Down Expand Up @@ -58,7 +57,7 @@ const init = async (matchedUrl: MatchedUrl | null) => {
};
const observeUrlChanges = () => {
let lastUrl = window.location.href;
const observer = new MutationObserver(() => {
const checkUrlChange = () => {
const currentUrl = window.location.href;
if (currentUrl !== lastUrl) {
lastUrl = currentUrl;
Expand All @@ -71,13 +70,13 @@ const observeUrlChanges = () => {
iframe.contentWindow.postMessage({ command: 'matchUrl', url: currentUrl }, '*');
}
}
});

//Observe changes in the main body of the document
};
const observer = new MutationObserver(checkUrlChange);
observer.observe(document.body, {
childList: true,
subtree: true,
});
setInterval(checkUrlChange, 1000);
};

window.addEventListener('message', (event: MessageEvent) => {
Expand Down

0 comments on commit 09b7c6d

Please sign in to comment.