mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-20 08:58:41 +00:00
修复配置也会错乱的bug
This commit is contained in:
parent
36680bbf3d
commit
eff88ea20c
@ -39,6 +39,9 @@ chrome.runtime.onMessage.addListener((request: PluginEvent, sender: any, sendRes
|
||||
}
|
||||
});
|
||||
chrome.tabs.onActivated.addListener(({ tabId, windowId }) => {});
|
||||
chrome.tabs.onRemoved.addListener((tabId, removeInfo) => {
|
||||
//
|
||||
});
|
||||
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
|
||||
// 页面发生刷新,通知重新生成数据
|
||||
if (changeInfo.status === "complete") {
|
||||
|
@ -101,16 +101,6 @@ export default defineComponent({
|
||||
chrome.scripting.executeScript({ files: ["js/execute.js"], target: { tabId: tabID } }, (results: chrome.scripting.InjectionResult[]) => {});
|
||||
}
|
||||
|
||||
function _inspectedCode() {
|
||||
let injectCode = "";
|
||||
chrome.devtools.inspectedWindow.eval(injectCode, (result, isException) => {
|
||||
if (isException) {
|
||||
console.error(isException);
|
||||
} else {
|
||||
console.log(`执行结果:${result}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
const funcEnableSchedule = (b: boolean) => {
|
||||
if (b) {
|
||||
timer.create();
|
||||
|
@ -34,25 +34,32 @@ export const appStore = defineStore("app", () => {
|
||||
const config = ref<ConfigData>(new ConfigData());
|
||||
const frameID = ref<number>(0);
|
||||
const pageShow = ref<boolean>(false);
|
||||
return {
|
||||
frameID,
|
||||
pageShow,
|
||||
config,
|
||||
init() {
|
||||
if (chrome.devtools) {
|
||||
window.addEventListener(PanelMsg.Show, () => {
|
||||
pageShow.value = true;
|
||||
});
|
||||
} else {
|
||||
pageShow.value = true;
|
||||
}
|
||||
profile.init(new ConfigData(), pluginConfig);
|
||||
const data = profile.load(`${pluginConfig.manifest.name}.json`) as ConfigData;
|
||||
|
||||
function readConfigFile(file: string) {
|
||||
const data = profile.load(file) as ConfigData;
|
||||
config.value.refreshType = data.refreshType || RefreshType.Manual;
|
||||
config.value.refreshTime = data.refreshTime || 500;
|
||||
config.value.expandTest = !!data.expandTest;
|
||||
config.value.refreshHirarchy = !!data.refreshHirarchy;
|
||||
config.value.refreshInspector = !!data.refreshInspector;
|
||||
}
|
||||
return {
|
||||
frameID,
|
||||
pageShow,
|
||||
config,
|
||||
init() {
|
||||
profile.init(new ConfigData(), pluginConfig);
|
||||
if (chrome.devtools) {
|
||||
window.addEventListener(PanelMsg.Show, () => {
|
||||
pageShow.value = true;
|
||||
});
|
||||
chrome.devtools.inspectedWindow.eval("window.location.href", (url: string, ex: chrome.devtools.inspectedWindow.EvaluationExceptionInfo) => {
|
||||
readConfigFile(url);
|
||||
});
|
||||
} else {
|
||||
pageShow.value = true;
|
||||
readConfigFile(`${pluginConfig.manifest.name}.json`);
|
||||
}
|
||||
},
|
||||
save() {
|
||||
const cfg = toRaw(config.value);
|
||||
|
@ -22,13 +22,6 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props, context) {
|
||||
function _evalCode(code: string) {
|
||||
if (chrome && chrome.devtools) {
|
||||
chrome.devtools.inspectedWindow.eval(code);
|
||||
} else {
|
||||
console.log(code);
|
||||
}
|
||||
}
|
||||
watch(
|
||||
() => props.data,
|
||||
(newValue: NodeInfoData, oldValue: NodeInfoData) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user